test(credential): Potential fix for race condition (#4587)

* test(credential): Potential fix for race condition

* test: Additional instances
This commit is contained in:
Michael Li authored and GitHub committed 2024-04-04 15:24:19 -04:00
1 parent 82a6ac057d
commit d74d667716
8 files changed
+9 -9

No files matched your search

@@ -330,7 +330,7 @@ func TestService_ListAliases(t *testing.T) {
filterFunc := func(_ context.Context, r *target.Alias) (bool, error) {
return true, nil
}
_, err = target.ListAliasesRefreshPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, relevantScopes)
_, err := target.ListAliasesRefreshPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, relevantScopes)
require.ErrorContains(t, err, "missing token")
})
t.Run("wrong token type", func(t *testing.T) {
@@ -178,7 +178,7 @@ func TestService_ListAccounts(t *testing.T) {
filterFunc := func(_ context.Context, a auth.Account) (bool, error) {
return true, nil
}
_, err = oidc.ListAccountsPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, authMethod.GetPublicId())
_, err := oidc.ListAccountsPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, authMethod.GetPublicId())
require.ErrorContains(t, err, "missing token")
})
t.Run("wrong token type", func(t *testing.T) {
@@ -269,7 +269,7 @@ func TestService_ListManagedGroups(t *testing.T) {
filterFunc := func(_ context.Context, mg auth.ManagedGroup) (bool, error) {
return true, nil
}
_, err = oidc.ListManagedGroupsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, authMethod.GetPublicId())
_, err := oidc.ListManagedGroupsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, authMethod.GetPublicId())
require.ErrorContains(t, err, "missing token")
})
t.Run("nil repo", func(t *testing.T) {
@@ -204,7 +204,7 @@ func TestStoreService_List(t *testing.T) {
filterFunc := func(_ context.Context, s credential.Store) (bool, error) {
return true, nil
}
_, err = credential.ListStoresPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, []string{prj.PublicId})
_, err := credential.ListStoresPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, []string{prj.PublicId})
require.ErrorContains(t, err, "missing token")
})
t.Run("wrong token type", func(t *testing.T) {
@@ -292,7 +292,7 @@ func TestStoreService_List(t *testing.T) {
filterFunc := func(_ context.Context, s credential.Store) (bool, error) {
return true, nil
}
_, err = credential.ListStoresRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, []string{prj.PublicId})
_, err := credential.ListStoresRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, []string{prj.PublicId})
require.ErrorContains(t, err, "missing token")
})
t.Run("missing repo", func(t *testing.T) {
@@ -257,7 +257,7 @@ func TestService_ListHostSets(t *testing.T) {
filterFunc := func(_ context.Context, s host.Set, plg *plugin.Plugin) (bool, error) {
return true, nil
}
_, _, err = hostplugin.ListHostSetsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, catalog.GetPublicId())
_, _, err := hostplugin.ListHostSetsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, catalog.GetPublicId())
require.ErrorContains(t, err, "missing token")
})
t.Run("nil repo", func(t *testing.T) {
@@ -258,7 +258,7 @@ func TestService_ListHosts(t *testing.T) {
filterFunc := func(_ context.Context, h host.Host, plg *plugin.Plugin) (bool, error) {
return true, nil
}
_, _, err = hostplugin.ListHostsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, catalog.GetPublicId())
_, _, err := hostplugin.ListHostsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, catalog.GetPublicId())
require.ErrorContains(t, err, "missing token")
})
t.Run("nil repo", func(t *testing.T) {
@@ -246,7 +246,7 @@ func TestService_ListHostSets(t *testing.T) {
filterFunc := func(_ context.Context, s host.Set) (bool, error) {
return true, nil
}
_, err = static.ListHostSetsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, catalog.GetPublicId())
_, err := static.ListHostSetsRefresh(ctx, []byte("some hash"), 1, filterFunc, nil, repo, catalog.GetPublicId())
require.ErrorContains(t, err, "missing token")
})
t.Run("nil repo", func(t *testing.T) {
+1 -1
View File
@@ -1957,7 +1957,7 @@ func TestService_ListScopes(t *testing.T) {
filterFunc := func(_ context.Context, r *iam.Scope) (bool, error) {
return true, nil
}
_, err = iam.ListScopesPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, []string{org.GetPublicId()})
_, err := iam.ListScopesPage(ctx, []byte("some hash"), 1, filterFunc, nil, repo, []string{org.GetPublicId()})
require.ErrorContains(t, err, "missing token")
})
t.Run("wrong token type", func(t *testing.T) {