test(bug): In TestExportImport, delete imported key, check if original exists #2472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR demonstrates a bug.
TestExportImport
creates a key named "john", usesExport
to export it, then usesImport
to import it into the same Keybase with the new name "john2". It checks if the address of the imported key is the same as the original key.This PR expands
TestExportImport
to delete the imported "john2" then usesHasByName("john")
to check if the original key still exists.To run the test:
Expected: pass. Actual: The test fails with:
Discussion: The
Export
function exports theInfo
struct which has the key name, in this case "john". ThenImport
imports the key with a new name, but does not change theInfo
struct. (Is this by design?) TheDelete
function fetches theInfo
struct from the database using the new name "john2", but it deletes based on the original name in the struct. This deletes the key under the original name.Maybe
Import
needs to modify theInfo
struct with the new name before storing in the database.