Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Make stuff fast #221

Merged
merged 6 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func runTests(extraTestArgs ...string) error {
args = append(args, "-v")
}
args = append(args, "-tags=jwx_es256k")
args = append(args, "-race")
args = append(args, "-short")
args = append(args, extraTestArgs...)
args = append(args, "./...")
Expand Down
7 changes: 7 additions & 0 deletions pkg/server/router/testutils_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package router

import (
"os"
"testing"

"github.com/stretchr/testify/require"
"github.com/tbd54566975/ssi-service/pkg/testutil"

"github.com/tbd54566975/ssi-service/config"
"github.com/tbd54566975/ssi-service/pkg/service/credential"
Expand All @@ -14,6 +16,11 @@ import (
"github.com/tbd54566975/ssi-service/pkg/storage"
)

func TestMain(t *testing.M) {
testutil.EnableSchemaCaching()
os.Exit(t.Run())
}

func testKeyStoreService(t *testing.T, db storage.ServiceStorage) *keystore.Service {
serviceConfig := config.KeyStoreServiceConfig{ServiceKeyPassword: "test-password"}
// create a keystore service
Expand Down
6 changes: 6 additions & 0 deletions pkg/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/TBD54566975/ssi-sdk/credential/exchange"
"github.com/tbd54566975/ssi-service/pkg/testutil"

manifestsdk "github.com/TBD54566975/ssi-sdk/credential/manifest"
"github.com/TBD54566975/ssi-sdk/crypto"
Expand All @@ -33,6 +34,11 @@ import (
"github.com/tbd54566975/ssi-service/pkg/storage"
)

func TestMain(t *testing.M) {
testutil.EnableSchemaCaching()
os.Exit(t.Run())
}

func TestHealthCheckAPI(t *testing.T) {
shutdown := make(chan os.Signal, 1)
serviceConfig, err := config.LoadConfig("")
Expand Down
21 changes: 21 additions & 0 deletions pkg/testutil/setup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package testutil

import (
"os"

"github.com/TBD54566975/ssi-sdk/schema"
)

func EnableSchemaCaching() {
s, err := schema.GetAllLocalSchemas()
if err != nil {
println(err)
os.Exit(1)
}
l, err := schema.NewCachingLoader(s)
if err != nil {
println(err)
os.Exit(1)
}
l.EnableHTTPCache()
}