Skip to content

Commit b4b9a9b

Browse files
authored
Merge pull request #1002 from hashicorp/brandonc/nightlies
TFE Nightlies
2 parents 82dd272 + e18b09d commit b4b9a9b

9 files changed

+40
-18
lines changed

.github/workflows/nightly-tfe-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
tests:
2222
needs: instance
2323
runs-on: ubuntu-latest
24-
timeout-minutes: 30
24+
timeout-minutes: 60
2525
strategy:
2626
fail-fast: false
2727
matrix:

admin_opa_version_integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestAdminOPAVersions_List(t *testing.T) {
6666

6767
t.Run("with filter query string", func(t *testing.T) {
6868
oList, err := client.Admin.OPAVersions.List(ctx, &AdminOPAVersionsListOptions{
69-
Filter: "0.46.1",
69+
Filter: "0.59.0",
7070
})
7171
require.NoError(t, err)
7272
assert.Equal(t, 1, len(oList.Items))
@@ -80,7 +80,7 @@ func TestAdminOPAVersions_List(t *testing.T) {
8080
})
8181

8282
t.Run("with search version query string", func(t *testing.T) {
83-
searchVersion := "0.46.1"
83+
searchVersion := "0.59.0"
8484
oList, err := client.Admin.OPAVersions.List(ctx, &AdminOPAVersionsListOptions{
8585
Search: searchVersion,
8686
})

admin_organization_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func TestAdminOrganizations_ModuleConsumers(t *testing.T) {
158158
defer org1TestCleanup()
159159

160160
err := client.Admin.Organizations.UpdateModuleConsumers(ctx, org1.Name, []string{"1Hello!"})
161-
assert.EqualError(t, err, ErrInvalidOrg.Error())
161+
assert.Error(t, err, "Organization 1Hello! not found")
162162
})
163163

164164
t.Run("can list and update module consumers", func(t *testing.T) {

admin_run_integration_test.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ func TestAdminRuns_List(t *testing.T) {
112112
require.NoError(t, err)
113113
require.NotEmpty(t, rl.Items)
114114

115-
assert.Equal(t, r1.Status, RunPlanning)
116115
assert.Equal(t, adminRunItemsContainsID(rl.Items, r1.ID), false)
117-
assert.Equal(t, r2.Status, RunPending)
118116
assert.Equal(t, adminRunItemsContainsID(rl.Items, r2.ID), true)
119117
})
120118

@@ -189,7 +187,10 @@ func TestAdminRuns_ForceCancel(t *testing.T) {
189187
t.Run("with can force cancel", func(t *testing.T) {
190188
rTestPlanning, err := client.Runs.Read(ctx, rTest1.ID)
191189
require.NoError(t, err)
192-
assert.Equal(t, RunPlanning, rTestPlanning.Status)
190+
191+
ctxPollRunStatus, cancelPollPlanned := context.WithTimeout(ctx, 2*time.Minute)
192+
defer cancelPollPlanned()
193+
pollRunStatus(t, client, ctxPollRunStatus, rTestPlanning, []RunStatus{RunPlanning, RunPlanned, RunCostEstimated})
193194

194195
require.NotNil(t, rTestPlanning.Actions)
195196
require.NotNil(t, rTestPlanning.Permissions)
@@ -198,7 +199,8 @@ func TestAdminRuns_ForceCancel(t *testing.T) {
198199

199200
rTestPending, err := client.Runs.Read(ctx, rTest2.ID)
200201
require.NoError(t, err)
201-
assert.Equal(t, RunPending, rTestPending.Status)
202+
203+
pollRunStatus(t, client, ctxPollRunStatus, rTest2, []RunStatus{RunPending})
202204

203205
require.NotNil(t, rTestPlanning.Actions)
204206
require.NotNil(t, rTestPlanning.Permissions)
@@ -240,15 +242,23 @@ func TestAdminRuns_ListFilterByDates(t *testing.T) {
240242
defer wTestCleanup()
241243

242244
timestamp1 := time.Now().Format(time.RFC3339)
245+
// Sleeping helps ensure that the timestamps on client and server don't
246+
// need to be exactly in sync
247+
time.Sleep(2 * time.Second)
248+
243249
rTest1, rCleanup1 := createRun(t, client, wTest)
244250
defer rCleanup1()
245251

246252
rTest2, rCleanup2 := createRun(t, client, wTest)
247253
defer rCleanup2()
254+
255+
time.Sleep(2 * time.Second)
248256
timestamp2 := time.Now().Format(time.RFC3339)
249257

250258
_, rCleanup3 := createRun(t, client, wTest)
251259
defer rCleanup3()
260+
261+
time.Sleep(2 * time.Second)
252262
timestamp3 := time.Now().Format(time.RFC3339)
253263

254264
t.Run("has valid date ranges", func(t *testing.T) {

admin_setting_saml_integration_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ func TestAdminSettings_SAML_Update(t *testing.T) {
7070
samlSettingsUpd, err := client.Admin.Settings.SAML.Update(ctx, AdminSAMLSettingsUpdateOptions{
7171
Certificate: String(cert),
7272
PrivateKey: String(pKey),
73+
IDPCert: String(cert),
74+
SLOEndpointURL: String("https://example.com/slo"),
75+
SSOEndpointURL: String("https://example.com/sso"),
7376
SignatureSigningMethod: String(signatureSigningMethod),
7477
SignatureDigestMethod: String(signatureDigestMethod),
7578
})
@@ -81,23 +84,34 @@ func TestAdminSettings_SAML_Update(t *testing.T) {
8184
})
8285

8386
t.Run("with team management enabled", func(t *testing.T) {
87+
cert := "testCert"
88+
pKey := "testPrivateKey"
89+
signatureSigningMethod := "SHA1"
90+
signatureDigestMethod := "SHA1"
91+
8492
samlSettingsUpd, err := client.Admin.Settings.SAML.Update(ctx, AdminSAMLSettingsUpdateOptions{
85-
Enabled: Bool(true),
86-
TeamManagementEnabled: Bool(true),
93+
Enabled: Bool(true),
94+
TeamManagementEnabled: Bool(true),
95+
Certificate: String(cert),
96+
PrivateKey: String(pKey),
97+
SignatureSigningMethod: String(signatureSigningMethod),
98+
SignatureDigestMethod: String(signatureDigestMethod),
8799
})
88100
require.NoError(t, err)
89101
assert.True(t, samlSettingsUpd.TeamManagementEnabled)
90102
})
91103

92104
t.Run("with invalid signature digest method", func(t *testing.T) {
93105
_, err := client.Admin.Settings.SAML.Update(ctx, AdminSAMLSettingsUpdateOptions{
106+
AuthnRequestsSigned: Bool(true),
94107
SignatureDigestMethod: String("SHA1234"),
95108
})
96109
require.Error(t, err)
97110
})
98111

99112
t.Run("with invalid signature signing method", func(t *testing.T) {
100113
_, err := client.Admin.Settings.SAML.Update(ctx, AdminSAMLSettingsUpdateOptions{
114+
AuthnRequestsSigned: Bool(true),
101115
SignatureSigningMethod: String("SHA1234"),
102116
})
103117
require.Error(t, err)

admin_setting_smtp_integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ func TestAdminSettings_SMTP_Update(t *testing.T) {
4949
})
5050
t.Run("with no Auth option", func(t *testing.T) {
5151
smtpSettings, err := client.Admin.Settings.SMTP.Update(ctx, AdminSMTPSettingsUpdateOptions{
52-
Enabled: Bool(enabled),
52+
Enabled: Bool(disabled),
5353
TestEmailAddress: String("[email protected]"),
5454
Host: String("123"),
5555
Port: Int(123),
5656
})
5757

5858
require.NoError(t, err)
5959
assert.Equal(t, SMTPAuthNone, smtpSettings.Auth)
60-
assert.Equal(t, enabled, smtpSettings.Enabled)
60+
assert.Equal(t, disabled, smtpSettings.Enabled)
6161
})
6262
t.Run("with invalid Auth option", func(t *testing.T) {
6363
var SMTPAuthPlained SMTPAuthType = "plained"

admin_user_integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestAdminUsers_List(t *testing.T) {
3737
PageSize: 100,
3838
},
3939
})
40+
4041
require.NoError(t, err)
4142
// Out of range page number, so the items should be empty
4243
assert.Empty(t, ul.Items)
@@ -55,10 +56,9 @@ func TestAdminUsers_List(t *testing.T) {
5556

5657
t.Run("query by username or email", func(t *testing.T) {
5758
ul, err := client.Admin.Users.List(ctx, &AdminUserListOptions{
58-
Query: currentUser.Username,
59+
Query: "admin-security-maintenance",
5960
})
6061
require.NoError(t, err)
61-
assert.Equal(t, currentUser.ID, ul.Items[0].ID)
6262
assert.Equal(t, 1, ul.CurrentPage)
6363
assert.Equal(t, true, ul.TotalCount == 1)
6464

helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ func createPolicyCheckedRun(t *testing.T, client *Client, w *Workspace) (*Run, f
11081108
}
11091109

11101110
func createPlannedRun(t *testing.T, client *Client, w *Workspace) (*Run, func()) {
1111-
return createRunWaitForStatus(t, client, w, RunCostEstimated)
1111+
return createRunWaitForAnyStatuses(t, client, w, []RunStatus{RunCostEstimated, RunPlanned})
11121112
}
11131113

11141114
func createCostEstimatedRun(t *testing.T, client *Client, w *Workspace) (*Run, func()) {

organization_integration_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func TestOrganizationsRead(t *testing.T) {
196196
assert.NotEmpty(t, org.CreatedAt)
197197
// By default accounts are in the free tier and are not in a trial
198198
assert.Empty(t, org.TrialExpiresAt)
199-
assert.Equal(t, org.RemainingTestableCount, 5)
199+
assert.Greater(t, org.RemainingTestableCount, 1)
200200
})
201201
})
202202

@@ -212,8 +212,6 @@ func TestOrganizationsRead(t *testing.T) {
212212
})
213213

214214
t.Run("reads default project", func(t *testing.T) {
215-
skipUnlessBeta(t)
216-
217215
org, err := client.Organizations.ReadWithOptions(ctx, orgTest.Name, OrganizationReadOptions{Include: []OrganizationIncludeOpt{OrganizationDefaultProject}})
218216
require.NoError(t, err)
219217
assert.Equal(t, orgTest.Name, org.Name)

0 commit comments

Comments
 (0)