Skip to content
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
4 changes: 2 additions & 2 deletions test/contract/audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

func TestDefaultAuditingGet(t *testing.T) {
ctx := context.Background()
contract.RunGoContractTest(ctx, t, "get default auditing", func(ch contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "get default auditing", func(t *testing.T, ch contract.ContractHelper) {
projectName := utils.RandomName("default-auditing-project")
require.NoError(t, ch.AddResources(ctx, 5*time.Minute, contract.DefaultAtlasProject(projectName)))
testProjectID, err := ch.ProjectID(ctx, projectName)
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestSyncs(t *testing.T) {
),
},
}
contract.RunGoContractTest(ctx, t, "test syncs", func(ch contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "test syncs", func(t *testing.T, ch contract.ContractHelper) {
projectName := utils.RandomName("audit-syncs-project")
require.NoError(t, ch.AddResources(ctx, 5*time.Minute, contract.DefaultAtlasProject(projectName)))
testProjectID, err := ch.ProjectID(ctx, projectName)
Expand Down
2 changes: 1 addition & 1 deletion test/contract/ipaccesslist/ipaccesslist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

func TestList(t *testing.T) {
ctx := context.Background()
contract.RunGoContractTest(ctx, t, "get default auditing", func(ch contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "get default auditing", func(t *testing.T, ch contract.ContractHelper) {
projectName := utils.RandomName("default-auditing-project")

prj := contract.DefaultAtlasProject(projectName).(*akov2.AtlasProject)
Expand Down
2 changes: 1 addition & 1 deletion test/contract/networkpeering/networkpeering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (

func TestPeerServiceCRUD(t *testing.T) {
ctx := context.Background()
contract.RunGoContractTest(ctx, t, "test peer CRUD", func(ch contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "test peer CRUD", func(t *testing.T, ch contract.ContractHelper) {
projectName := utils.RandomName("peer-connection-crud-project")
require.NoError(t, ch.AddResources(ctx, 5*time.Minute, contract.DefaultAtlasProject(projectName)))
testProjectID, err := ch.ProjectID(ctx, projectName)
Expand Down
4 changes: 2 additions & 2 deletions test/helper/contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (ct *contractTest) cleanup(ctx context.Context) error {
return nil
}

func RunGoContractTest(ctx context.Context, t *testing.T, name string, contractTest func(ch ContractHelper)) {
func RunGoContractTest(ctx context.Context, t *testing.T, name string, contractTest func(t *testing.T, ch ContractHelper)) {
if err := skipCheck(name, os.Getenv("AKO_CONTRACT_TEST_FOCUS"), control.Enabled("AKO_CONTRACT_TEST")); err != nil {
t.Skipf("Skipping contract test: %v", err.Error())
}
Expand All @@ -61,7 +61,7 @@ func RunGoContractTest(ctx context.Context, t *testing.T, name string, contractT
require.NoError(t, ct.cleanup(ctx))
}()
t.Run(name, func(t *testing.T) {
contractTest(ct)
contractTest(t, ct)
})
}

Expand Down
8 changes: 4 additions & 4 deletions test/helper/contract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
func TestContractTestSkip(t *testing.T) {
ctx := context.Background()
testWithEnv(func() {
contract.RunGoContractTest(ctx, t, "Skip contract test", func(_ contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "Skip contract test", func(t *testing.T, _ contract.ContractHelper) {
panic("should not have got here!")
})
}, "-AKO_CONTRACT_TEST")
Expand All @@ -32,7 +32,7 @@ func TestContractTestClientSetFails(t *testing.T) {
ctx := context.Background()
testWithEnv(func() {
assert.Panics(t, func() {
contract.RunGoContractTest(ctx, t, "bad client settings panics", func(_ contract.ContractHelper) {})
contract.RunGoContractTest(ctx, t, "bad client settings panics", func(t *testing.T, _ contract.ContractHelper) {})
})
},
"AKO_CONTRACT_TEST=1",
Expand All @@ -43,12 +43,12 @@ func TestContractTestClientSetFails(t *testing.T) {

func TestContractsWithResources(t *testing.T) {
ctx := context.Background()
contract.RunGoContractTest(ctx, t, "run contract test list projects", func(ch contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "run contract test list projects", func(t *testing.T, ch contract.ContractHelper) {
ch.AddResources(ctx, time.Minute, contract.DefaultAtlasProject("contract-tests-list-projects"))
_, _, err := ch.AtlasClient().ProjectsApi.ListProjects(ctx).Execute()
assert.NoError(t, err)
})
contract.RunGoContractTest(ctx, t, "run contract test list orgs", func(ch contract.ContractHelper) {
contract.RunGoContractTest(ctx, t, "run contract test list orgs", func(t *testing.T, ch contract.ContractHelper) {
ch.AddResources(ctx, time.Minute, contract.DefaultAtlasProject("contract-tests-list-orgs"))
_, _, err := ch.AtlasClient().OrganizationsApi.ListOrganizations(ctx).Execute()
assert.NoError(t, err)
Expand Down