From a878208201225a69b349bd1dff7369889bf6c1e4 Mon Sep 17 00:00:00 2001 From: Howard Zhong Date: Tue, 31 Dec 2024 19:00:52 +0000 Subject: [PATCH] attempt to solve timeout --- registry/client_commands_test.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/registry/client_commands_test.go b/registry/client_commands_test.go index 190613e20..4ffb06ce5 100644 --- a/registry/client_commands_test.go +++ b/registry/client_commands_test.go @@ -94,10 +94,12 @@ func getSortedKids(ctx context.Context, jsonStr string) ([]string, error) { func TestServeNamespaceRegistry(t *testing.T) { ctx, cancel, egrp := test_utils.TestContext(context.Background(), t) t.Cleanup(func() { - func() { require.NoError(t, egrp.Wait()) }() + if r := recover(); r != nil { + t.Errorf("Test panicked: %v", r) + } + cancel() - config.ResetIssuerJWKPtr() - config.ResetIssuerPrivateKeys() + assert.NoError(t, egrp.Wait()) server_utils.ResetTestState() }) server_utils.ResetTestState() @@ -214,16 +216,18 @@ func TestMultiPubKeysRegisteredOnNamespace(t *testing.T) { ctx, cancel, egrp := test_utils.TestContext(context.Background(), t) server_utils.ResetTestState() t.Cleanup(func() { - func() { require.NoError(t, egrp.Wait()) }() + if r := recover(); r != nil { + t.Errorf("Test panicked: %v", r) + } + cancel() - config.ResetIssuerJWKPtr() - config.ResetIssuerPrivateKeys() + assert.NoError(t, egrp.Wait()) server_utils.ResetTestState() }) tDir := t.TempDir() - svr := registryMockup(ctx, t, "serveregistry") + svr := registryMockup(ctx, t, "MultiPubKeysRegisteredOnNamespace") defer func() { err := ShutdownRegistryDB() assert.NoError(t, err) @@ -309,6 +313,10 @@ func TestRegistryKeyChainingOSDF(t *testing.T) { ctx, cancel, egrp := test_utils.TestContext(context.Background(), t) t.Cleanup(func() { + if r := recover(); r != nil { + t.Errorf("Test panicked: %v", r) + } + cancel() assert.NoError(t, egrp.Wait()) server_utils.ResetTestState() @@ -410,6 +418,10 @@ func TestRegistryKeyChaining(t *testing.T) { ctx, cancel, egrp := test_utils.TestContext(context.Background(), t) t.Cleanup(func() { + if r := recover(); r != nil { + t.Errorf("Test panicked: %v", r) + } + cancel() assert.NoError(t, egrp.Wait()) server_utils.ResetTestState()