Skip to content

Commit

Permalink
test: Update skipped (1, 0) root node test
Browse files Browse the repository at this point in the history
  • Loading branch information
drklee3 committed Aug 20, 2024
1 parent c1d6db0 commit cdfc587
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions mutable_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1476,18 +1476,25 @@ func TestMutableTree_InitialVersion_FirstVersion(t *testing.T) {

// ------------------------------
// Verify
// 1. Node exists with Version 1, not InitialVersion
// 1. Node exists with Version 1 and nonce 0, not InitialVersion
// 2. VersionExists(InitialVersion) - should return true
// 3. AvailableVersions() - should include InitialVersion and NOT version 1
// 4. ndb.GetRoot(InitialVersion) - should return the root node
// 5. GetImmutable(InitialVersion) - should return the immutable tree
// 6. LoadVersion(InitialVersion) - loads tree even if node contains version 1. This is last since it runs some previous methods internally

// the nodes created at the first version are not assigned with the `InitialVersion`
t.Run("1. root node exists at RootKey(initialVersion) with nodeKey version 1", func(t *testing.T) {
t.Skip()
rootKey := GetRootKey(initialVersion)
node, err := tree.ndb.GetNode(rootKey)
t.Run("1. root node exists at (1, 0) with nodeKey version 1", func(t *testing.T) {
_, err := tree.ndb.GetNode(GetRootKey(initialVersion))
require.Error(t, err)
require.ErrorContains(t, err, "error reading Node.", "root node at initialVersion should be a reference node")

_, err = tree.ndb.GetNode(GetRootKey(1))
require.Error(t, err)
require.ErrorContains(t, err, "Value missing for key", "(1, 1) should not exist")

rnk := &NodeKey{version: 1, nonce: 0}
node, err := tree.ndb.GetNode(rnk.GetKey())
require.NoError(t, err)

// Calling GetNode with rootKey actually sets the returned Node.nodeKey.
Expand Down

0 comments on commit cdfc587

Please sign in to comment.