Skip to content

Commit

Permalink
Merge branch 'main' into release-1.54
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrombley authored May 28, 2024
2 parents e72996f + 8e03594 commit 8285714
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/actions/lint-go-tfe/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runs:
using: composite
steps:
- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
cache: true
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/test-go-tfe/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ runs:
using: composite
steps:
- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
cache: true
Expand All @@ -65,7 +65,7 @@ runs:

- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
with:
workflow_conclusion: success
name: junit-test-summary
Expand Down Expand Up @@ -99,7 +99,7 @@ runs:
GO111MODULE: "on"
ENABLE_TFE: ${{ inputs.enterprise }}
run: |
gotestsum --junitfile summary.xml --format short-verbose -- -parallel=1 -timeout=119m -run "${{ steps.test_split.outputs.run }}"
gotestsum --junitfile summary.xml --format short-verbose -- -parallel=1 -timeout=59m -run "${{ steps.test_split.outputs.run }}"
- name: Upload test artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

concurrency:
group: ${{ github.head_ref || github.ref }}
group: "one"
cancel-in-progress: true

jobs:
Expand All @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: ./.github/actions/lint-go-tfe

Expand All @@ -29,18 +29,17 @@ jobs:
total: [ 1 ]
index: [ 0 ]

timeout-minutes: 120
steps:
- name: terraform-cloud-outputs
id: tflocal
uses: hashicorp-forge/terraform-cloud-action/outputs@4adbe7eea886138ac10a4c09e63c5c568aaa6672
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: hashicorp-v2
workspace: tflocal-go-tfe

- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: ./.github/actions/test-go-tfe
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly-tfe-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 20
steps:
- name: terraform-cloud/apply
uses: hashicorp-forge/terraform-cloud-action/apply@4adbe7eea886138ac10a4c09e63c5c568aaa6672
uses: hashicorp-forge/terraform-cloud-action/apply@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
organization: hashicorp-v2
workspace: tflocal-go-tfe-nightly
Expand All @@ -31,14 +31,14 @@ jobs:
steps:
- name: terraform-cloud/outputs
id: tflocal
uses: hashicorp-forge/terraform-cloud-action/outputs@4adbe7eea886138ac10a4c09e63c5c568aaa6672
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: hashicorp-v2
workspace: tflocal-go-tfe-nightly

- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: ./.github/actions/test-go-tfe
with:
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
if: "${{ always() }}"
steps:
- name: terraform-cloud/destroy
uses: hashicorp-forge/terraform-cloud-action/destroy@4adbe7eea886138ac10a4c09e63c5c568aaa6672
uses: hashicorp-forge/terraform-cloud-action/destroy@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: hashicorp-v2
Expand Down
54 changes: 27 additions & 27 deletions workspace_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type WorkspaceTableOptions struct {
type WorkspaceTableTest struct {
scenario string
options *WorkspaceTableOptions
setup func(options *WorkspaceTableOptions) (w *Workspace, cleanup func())
assertion func(w *Workspace, options *WorkspaceTableOptions, err error)
setup func(t *testing.T, options *WorkspaceTableOptions) (w *Workspace, cleanup func())
assertion func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error)
}

func TestWorkspacesList(t *testing.T) {
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
TagsRegex: String("barfoo")},
},
},
setup: func(options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
setup: func(t *testing.T, options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
// Remove the below organization creation and use the one from the outer scope once the feature flag is removed
orgTest, orgTestCleanup := createOrganizationWithOptions(t, client, OrganizationCreateOptions{
Name: String("tst-" + randomString(t)[0:20]),
Expand All @@ -315,7 +315,7 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
t.Cleanup(wTestCleanup)
}
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Equal(t, *options.createOptions.VCSRepo.TagsRegex, w.VCSRepo.TagsRegex)

// Get a refreshed view from the API.
Expand All @@ -340,7 +340,7 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
TriggerPatterns: []string{"/module-1/**/*", "/**/networking/*"},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndTriggerPatterns.Error())
},
Expand All @@ -355,7 +355,7 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
TriggerPrefixes: []string{"/module-1", "/module-2"},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndTriggerPrefixes.Error())
},
Expand All @@ -369,7 +369,7 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndFileTriggersEnabled.Error())
},
Expand All @@ -383,14 +383,14 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
setup: func(options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
setup: func(t *testing.T, options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
w, wTestCleanup := createWorkspaceWithVCS(t, client, orgTest, *options.createOptions)

return w, func() {
t.Cleanup(wTestCleanup)
}
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
require.NotNil(t, w)
require.NoError(t, err)
},
Expand All @@ -403,12 +403,12 @@ func TestWorkspacesCreateTableDriven(t *testing.T) {
var cleanup func()
var err error
if tableTest.setup != nil {
workspace, cleanup = tableTest.setup(tableTest.options)
workspace, cleanup = tableTest.setup(t, tableTest.options)
defer cleanup()
} else {
workspace, err = client.Workspaces.Create(ctx, orgTest.Name, *tableTest.options.createOptions)
}
tableTest.assertion(workspace, tableTest.options, err)
tableTest.assertion(t, workspace, tableTest.options, err)
})
}
}
Expand Down Expand Up @@ -437,7 +437,7 @@ func TestWorkspacesCreateTableDrivenWithGithubApp(t *testing.T) {
TagsRegex: String("barfoo")},
},
},
setup: func(options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
setup: func(t *testing.T, options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
// Remove the below organization creation and use the one from the outer scope once the feature flag is removed
orgTest, orgTestCleanup := createOrganizationWithOptions(t, client, OrganizationCreateOptions{
Name: String("tst-" + randomString(t)[0:20]),
Expand All @@ -451,7 +451,7 @@ func TestWorkspacesCreateTableDrivenWithGithubApp(t *testing.T) {
t.Cleanup(wTestCleanup)
}
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Equal(t, *options.createOptions.VCSRepo.TagsRegex, w.VCSRepo.TagsRegex)

// Get a refreshed view from the API.
Expand All @@ -473,12 +473,12 @@ func TestWorkspacesCreateTableDrivenWithGithubApp(t *testing.T) {
var cleanup func()
var err error
if tableTest.setup != nil {
workspace, cleanup = tableTest.setup(tableTest.options)
workspace, cleanup = tableTest.setup(t, tableTest.options)
defer cleanup()
} else {
workspace, err = client.Workspaces.Create(ctx, orgTest1.Name, *tableTest.options.createOptions)
}
tableTest.assertion(workspace, tableTest.options, err)
tableTest.assertion(t, workspace, tableTest.options, err)
})
}
}
Expand Down Expand Up @@ -1350,7 +1350,7 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
setup: func(options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
setup: func(t *testing.T, options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
orgTest, orgTestCleanup := createOrganizationWithOptions(t, client, OrganizationCreateOptions{
Name: String("tst-" + randomString(t)[0:20]),
Email: String(fmt.Sprintf("%s@tfe.local", randomString(t))),
Expand All @@ -1362,7 +1362,7 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
t.Cleanup(wTestCleanup)
}
},
assertion: func(workspace *Workspace, options *WorkspaceTableOptions, _ error) {
assertion: func(t *testing.T, workspace *Workspace, options *WorkspaceTableOptions, _ error) {
assert.Equal(t, *options.createOptions.VCSRepo.TagsRegex, workspace.VCSRepo.TagsRegex)
assert.Equal(t, workspace.VCSRepo.TagsRegex, *String("barfoo")) // Sanity test

Expand Down Expand Up @@ -1393,7 +1393,7 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndFileTriggersEnabled.Error())
},
Expand All @@ -1407,7 +1407,7 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndFileTriggersEnabled.Error())
},
Expand All @@ -1422,7 +1422,7 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndTriggerPrefixes.Error())
},
Expand All @@ -1437,7 +1437,7 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
VCSRepo: &VCSRepoOptions{TagsRegex: String("foobar")},
},
},
assertion: func(w *Workspace, options *WorkspaceTableOptions, err error) {
assertion: func(t *testing.T, w *Workspace, options *WorkspaceTableOptions, err error) {
assert.Nil(t, w)
assert.EqualError(t, err, ErrUnsupportedBothTagsRegexAndTriggerPatterns.Error())
},
Expand All @@ -1450,12 +1450,12 @@ func TestWorkspacesUpdateTableDriven(t *testing.T) {
var cleanup func()
var err error
if tableTest.setup != nil {
workspace, cleanup = tableTest.setup(tableTest.options)
workspace, cleanup = tableTest.setup(t, tableTest.options)
defer cleanup()
} else {
workspace, err = client.Workspaces.Update(ctx, orgTest.Name, wTest.Name, *tableTest.options.updateOptions)
}
tableTest.assertion(workspace, tableTest.options, err)
tableTest.assertion(t, workspace, tableTest.options, err)
})
}
}
Expand Down Expand Up @@ -1493,7 +1493,7 @@ func TestWorkspacesUpdateTableDrivenWithGithubApp(t *testing.T) {
},
},
},
setup: func(options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
setup: func(t *testing.T, options *WorkspaceTableOptions) (w *Workspace, cleanup func()) {
orgTest, orgTestCleanup := createOrganizationWithOptions(t, client, OrganizationCreateOptions{
Name: String("tst-" + randomString(t)[0:20]),
Email: String(fmt.Sprintf("%s@tfe.local", randomString(t))),
Expand All @@ -1505,7 +1505,7 @@ func TestWorkspacesUpdateTableDrivenWithGithubApp(t *testing.T) {
t.Cleanup(wTestCleanup)
}
},
assertion: func(workspace *Workspace, options *WorkspaceTableOptions, _ error) {
assertion: func(t *testing.T, workspace *Workspace, options *WorkspaceTableOptions, _ error) {
assert.Equal(t, *options.createOptions.VCSRepo.TagsRegex, workspace.VCSRepo.TagsRegex)
assert.Equal(t, workspace.VCSRepo.TagsRegex, *String("barfoo")) // Sanity test

Expand All @@ -1522,12 +1522,12 @@ func TestWorkspacesUpdateTableDrivenWithGithubApp(t *testing.T) {
var cleanup func()
var err error
if tableTest.setup != nil {
workspace, cleanup = tableTest.setup(tableTest.options)
workspace, cleanup = tableTest.setup(t, tableTest.options)
defer cleanup()
} else {
workspace, err = client.Workspaces.Update(ctx, orgTest.Name, wTest.Name, *tableTest.options.updateOptions)
}
tableTest.assertion(workspace, tableTest.options, err)
tableTest.assertion(t, workspace, tableTest.options, err)
})
}
}
Expand Down

0 comments on commit 8285714

Please sign in to comment.