mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 23:32:47 +01:00
test: add upgrade tests (#1126)
This commit is contained in:
44
upgradetest/upgrade_test.go
Normal file
44
upgradetest/upgrade_test.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package upgradetest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/app"
|
||||
"github.com/SecurityBrewery/catalyst/fakedata"
|
||||
)
|
||||
|
||||
func TestUpgrades(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dirEntries, err := os.ReadDir("data")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, entry := range dirEntries {
|
||||
if !entry.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
t.Run(entry.Name(), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
pb, err := app.App(filepath.Join("data", entry.Name()), true)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := pb.Bootstrap(); err != nil {
|
||||
t.Fatal(fmt.Errorf("failed to bootstrap: %w", err))
|
||||
}
|
||||
|
||||
if err := fakedata.ValidateDefaultData(pb); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user