[#1059] pilorama: Run ascending tree sort test against boltdb
Some checks failed
DCO action / DCO (pull_request) Successful in 5m40s
Vulncheck / Vulncheck (pull_request) Successful in 5m38s
Build / Build Components (1.21) (pull_request) Successful in 6m58s
Build / Build Components (1.20) (pull_request) Successful in 7m10s
Tests and linters / Lint (pull_request) Failing after 7m9s
Tests and linters / Staticcheck (pull_request) Successful in 7m23s
Tests and linters / gopls check (pull_request) Successful in 7m46s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m15s
Tests and linters / Tests (1.21) (pull_request) Successful in 9m18s
Tests and linters / Tests with -race (pull_request) Successful in 10m35s

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2024-04-01 20:59:40 +03:00
parent bae4cc1c18
commit b595ba2992

View file

@ -4,6 +4,7 @@ import (
"context"
"errors"
"path"
"path/filepath"
"sort"
"testing"
@ -123,9 +124,21 @@ func TestGetSubTree(t *testing.T) {
}
func TestGetSubTreeOrderAsc(t *testing.T) {
t.Run("memory forest", func(t *testing.T) {
testGetSubTreeOrderAsc(t, pilorama.NewMemoryForest())
})
t.Run("boltdb forest", func(t *testing.T) {
p := pilorama.NewBoltForest(pilorama.WithPath(filepath.Join(t.TempDir(), "pilorama")))
require.NoError(t, p.Open(context.Background(), 0644))
require.NoError(t, p.Init())
testGetSubTreeOrderAsc(t, p)
})
}
func testGetSubTreeOrderAsc(t *testing.T, p pilorama.ForestStorage) {
d := pilorama.CIDDescriptor{CID: cidtest.ID(), Size: 1}
treeID := "sometree"
p := pilorama.NewMemoryForest()
tree := []struct {
path []string