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

Remove Beta flag from Terraform Test test suite #857

Merged
merged 1 commit into from
Feb 21, 2024
Merged
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
39 changes: 14 additions & 25 deletions test_variables_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
)

func TestTestVariablesList(t *testing.T) {
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()

Expand Down Expand Up @@ -84,8 +82,6 @@ func TestTestVariablesList(t *testing.T) {
}

func TestTestVariablesCreate(t *testing.T) {
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()

Expand Down Expand Up @@ -221,8 +217,6 @@ func TestTestVariablesCreate(t *testing.T) {
}

func TestTestVariablesUpdate(t *testing.T) {
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()

Expand All @@ -244,6 +238,20 @@ func TestTestVariablesUpdate(t *testing.T) {

defer tvCleanup1()

t.Run("without any changes", func(t *testing.T) {
v, err := client.TestVariables.Update(ctx, id, vTest.ID, VariableUpdateOptions{})
require.NoError(t, err)

assert.Equal(t, vTest.ID, v.ID)
assert.Equal(t, vTest.Key, v.Key)
assert.Equal(t, vTest.Value, v.Value)
assert.Equal(t, vTest.Description, v.Description)
assert.Equal(t, vTest.Category, v.Category)
assert.Equal(t, vTest.HCL, v.HCL)
assert.Equal(t, vTest.Sensitive, v.Sensitive)
assert.NotEqual(t, vTest.VersionID, v.VersionID)
})

t.Run("with valid options", func(t *testing.T) {
options := VariableUpdateOptions{
Key: String("newname"),
Expand Down Expand Up @@ -287,32 +295,13 @@ func TestTestVariablesUpdate(t *testing.T) {
assert.NotEqual(t, vTest.VersionID, v.VersionID)
})

t.Run("without any changes", func(t *testing.T) {
vTest, vTestCleanup := createVariable(t, client, nil)
defer vTestCleanup()

v, err := client.TestVariables.Update(ctx, id, vTest.ID, VariableUpdateOptions{})
require.NoError(t, err)

assert.Equal(t, vTest.ID, v.ID)
assert.Equal(t, vTest.Key, v.Key)
assert.Equal(t, vTest.Value, v.Value)
assert.Equal(t, vTest.Description, v.Description)
assert.Equal(t, vTest.Category, v.Category)
assert.Equal(t, vTest.HCL, v.HCL)
assert.Equal(t, vTest.Sensitive, v.Sensitive)
assert.NotEqual(t, vTest.VersionID, v.VersionID)
})

t.Run("with invalid variable ID", func(t *testing.T) {
_, err := client.TestVariables.Update(ctx, id, badIdentifier, VariableUpdateOptions{})
assert.Equal(t, err, ErrInvalidVariableID)
})
}

func TestTestVariablesDelete(t *testing.T) {
skipUnlessBeta(t)

client := testClient(t)
ctx := context.Background()

Expand Down
Loading