Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: skipIfBeta is worded as the opposite logic #598

Merged
merged 4 commits into from Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions agent_integration_test.go
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestAgentsRead(t *testing.T) {
skipIfNotLinuxAmd64(t)
skipUnlessLinuxAMD64(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -43,7 +43,7 @@ func TestAgentsRead(t *testing.T) {
}

func TestAgentsList(t *testing.T) {
skipIfNotLinuxAmd64(t)
skipUnlessLinuxAMD64(t)

client := testClient(t)
ctx := context.Background()
Expand Down
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Expand Up @@ -57,11 +57,11 @@ Beta features, if released, should be clearly commented:
ExampleNewField *bool `jsonapi:"attr,example-new-field,omitempty"`
```

When adding test cases, you can temporarily use the skipIfBeta() test helper to omit beta features from running in CI.
When adding test cases, you can temporarily use the skipUnlessBeta() test helper to omit beta features from running in CI.

```
t.Run("with nested changes trigger", func (t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)
options := WorkspaceCreateOptions {
// rest of required fields here
ExampleNewField: Bool(true),
Expand All @@ -70,7 +70,7 @@ t.Run("with nested changes trigger", func (t *testing.T) {
})
```

**Note**: After your PR has been merged, and the feature either reaches general availability, you should remove the `skipIfBeta()` flag.
**Note**: After your PR has been merged, and the feature either reaches general availability, you should remove the `skipUnlessBeta()` flag.

## Adding New Endpoints

Expand Down
4 changes: 2 additions & 2 deletions helper_test.go
Expand Up @@ -2168,14 +2168,14 @@ func skipIfFreeOnly(t *testing.T) {
}

// skips a test if the test requires a beta feature
func skipIfBeta(t *testing.T) {
func skipUnlessBeta(t *testing.T) {
brandonc marked this conversation as resolved.
Show resolved Hide resolved
if !betaFeaturesEnabled() {
t.Skip("Skipping test related to a Terraform Cloud beta feature. Set ENABLE_BETA=1 to run.")
}
}

// skips a test if the architecture is not linux_amd64
func skipIfNotLinuxAmd64(t *testing.T) {
func skipUnlessLinuxAMD64(t *testing.T) {
if !linuxAmd64() {
t.Skip("Skipping test if architecture is not linux_amd64")
}
Expand Down
6 changes: 3 additions & 3 deletions organization_integration_test.go
Expand Up @@ -182,7 +182,7 @@ func TestOrganizationsRead(t *testing.T) {
})

t.Run("reads default project", func(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

org, err := client.Organizations.ReadWithOptions(ctx, orgTest.Name, OrganizationReadOptions{Include: []OrganizationIncludeOpt{OrganizationDefaultProject}})
require.NoError(t, err)
Expand Down Expand Up @@ -520,7 +520,7 @@ func TestOrganization_Unmarshal(t *testing.T) {

func TestOrganizationsReadRunTasksPermission(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -543,7 +543,7 @@ func TestOrganizationsReadRunTasksPermission(t *testing.T) {
func TestOrganizationsReadRunTasksEntitlement(t *testing.T) {
skipIfEnterprise(t)
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
6 changes: 3 additions & 3 deletions policy_evaluation_beta_test.go
Expand Up @@ -10,7 +10,7 @@ import (

func TestPolicyEvaluationList_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -66,7 +66,7 @@ func TestPolicyEvaluationList_Beta(t *testing.T) {

func TestPolicySetOutcomeList_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestPolicySetOutcomeList_Beta(t *testing.T) {

func TestPolicySetOutcomeRead_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
6 changes: 3 additions & 3 deletions policy_integration_beta_test.go
Expand Up @@ -10,7 +10,7 @@ import (

func TestPoliciesCreate_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -221,7 +221,7 @@ func TestPoliciesCreate_Beta(t *testing.T) {

func TestPoliciesList_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -309,7 +309,7 @@ func TestPoliciesList_Beta(t *testing.T) {

func TestPoliciesUpdate_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
6 changes: 3 additions & 3 deletions policy_set_integration_beta_test.go
Expand Up @@ -13,7 +13,7 @@ import (

func TestPolicySetsList_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -111,7 +111,7 @@ func TestPolicySetsList_Beta(t *testing.T) {

func TestPolicySetsCreate_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -334,7 +334,7 @@ func TestPolicySetsCreate_Beta(t *testing.T) {

func TestPolicySetsUpdate_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
10 changes: 5 additions & 5 deletions projects_integration_test.go
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestProjectsList(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestProjectsList(t *testing.T) {
}

func TestProjectsRead(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestProjectsRead(t *testing.T) {
}

func TestProjectsCreate(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestProjectsCreate(t *testing.T) {
}

func TestProjectsUpdate(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestProjectsUpdate(t *testing.T) {
}

func TestProjectsDelete(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
4 changes: 2 additions & 2 deletions registry_module_integration_test.go
Expand Up @@ -142,7 +142,7 @@ func TestRegistryModulesCreate(t *testing.T) {
})

t.Run("with no-code attribute", func(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)
options := RegistryModuleCreateOptions{
Name: String("iam"),
Provider: String("aws"),
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestRegistryModulesCreate(t *testing.T) {
}

func TestRegistryModuleUpdate(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)
client := testClient(t)
ctx := context.Background()

Expand Down
6 changes: 3 additions & 3 deletions task_stages_integration_beta_test.go
Expand Up @@ -10,7 +10,7 @@ import (

func TestTaskStagesRead_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestTaskStagesRead_Beta(t *testing.T) {

func TestTaskStagesList_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -172,7 +172,7 @@ func TestTaskStagesList_Beta(t *testing.T) {

func TestTaskStageOverride_Beta(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
4 changes: 2 additions & 2 deletions team_access_integration_test.go
Expand Up @@ -338,7 +338,7 @@ func TestTeamAccessesRemove(t *testing.T) {

func TestTeamAccessesReadRunTasks(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)
skipIfEnterprise(t)

client := testClient(t)
Expand Down Expand Up @@ -368,7 +368,7 @@ func TestTeamAccessesReadRunTasks(t *testing.T) {

func TestTeamAccessesUpdateRunTasks(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletion team_integration_test.go
Expand Up @@ -364,7 +364,7 @@ func TestTeamCreateOptions_Marshal(t *testing.T) {

func TestTeamsUpdateRunTasks(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)
skipIfEnterprise(t)

client := testClient(t)
Expand Down
8 changes: 4 additions & 4 deletions workspace_integration_test.go
Expand Up @@ -353,7 +353,7 @@ func TestWorkspacesCreate(t *testing.T) {
t.Cleanup(orgTestCleanup)

t.Run("with valid project option", func(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

options := WorkspaceCreateOptions{
Name: String(fmt.Sprintf("foo-%s", randomString(t))),
Expand Down Expand Up @@ -824,7 +824,7 @@ func TestWorkspacesUpdate(t *testing.T) {
})

t.Run("when updating project", func(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)

kBefore, kTestCleanup := createProject(t, client, orgTest)
defer kTestCleanup()
Expand Down Expand Up @@ -2129,7 +2129,7 @@ func TestWorkspaceCreateOptions_Marshal(t *testing.T) {

func TestWorkspacesRunTasksPermission(t *testing.T) {
skipIfFreeOnly(t)
skipIfBeta(t)
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -2149,7 +2149,7 @@ func TestWorkspacesRunTasksPermission(t *testing.T) {
}

func TestWorkspacesProjects(t *testing.T) {
skipIfBeta(t)
skipUnlessBeta(t)
client := testClient(t)
ctx := context.Background()

Expand Down
4 changes: 2 additions & 2 deletions workspace_run_task_integration_test.go
Expand Up @@ -46,7 +46,7 @@ func TestWorkspaceRunTasksCreate(t *testing.T) {

func TestWorkspaceRunTasksCreateBeta(t *testing.T) {
// Once Pre-Plan Tasks are generally available, this can replace the above TestWorkspaceRunTasksCreate
skipIfBeta(t)
skipUnlessBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
Expand Down Expand Up @@ -188,7 +188,7 @@ func TestWorkspaceRunTasksUpdate(t *testing.T) {

func TestWorkspaceRunTasksUpdateBeta(t *testing.T) {
// Once Pre-Plan Tasks are generally available, this can replace the above TestWorkspaceRunTasksUpdate
skipIfBeta(t)
skipUnlessBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
Expand Down