Skip to content

Commit

Permalink
test: Randomize root pass for Linode creations in integration tests (#…
Browse files Browse the repository at this point in the history
…433)

* randomize all rootPass upon instance creation

* update fixtures
  • Loading branch information
ykim-1 committed Dec 5, 2023
1 parent f5c858a commit d853175
Show file tree
Hide file tree
Showing 9 changed files with 1,656 additions and 77,640 deletions.
2 changes: 0 additions & 2 deletions test/integration/example_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ func randString(length int, characterClasses ...string) string {
return string(b)
}

// randPassword generates a password sufficient to pass the Linode API standards,
// don't use it outside of this example script where the Linode is immediately destroyed.
func randPassword() string {
return randString(64, lowerBytes, upperBytes, digits, symbols)
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/example_nodebalancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func ExampleClient_CreateNodeBalancerNode() {
booted := false
instanceOpts := linodego.InstanceCreateOptions{
Label: "nodebalancer-example-instance",
RootPass: "R34lBAdP455!!!",
RootPass: randPassword(),
Region: "us-southeast",
Type: "g6-nanode-1",
Image: "linode/debian9",
Expand Down
596 changes: 440 additions & 156 deletions test/integration/fixtures/TestEventPoller_InstancePower.yaml

Large diffs are not rendered by default.

21,868 changes: 240 additions & 21,628 deletions test/integration/fixtures/TestInstance_Disk_ListMultiple_Primary.yaml

Large diffs are not rendered by default.

55,949 changes: 322 additions & 55,627 deletions test/integration/fixtures/TestInstance_Disk_ListMultiple_Secondary.yaml

Large diffs are not rendered by default.

380 changes: 298 additions & 82 deletions test/integration/fixtures/TestInstance_Disk_ResetPassword.yaml

Large diffs are not rendered by default.

487 changes: 349 additions & 138 deletions test/integration/fixtures/TestWaitForResourceFree.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/integration/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func TestInstance_Disk_ListMultiple(t *testing.T) {
_, err = client.CreateInstanceDisk(context.Background(), instance2.ID, linodego.InstanceDiskCreateOptions{
Label: "go-disk-test-" + randLabel(),
Image: image.ID,
RootPass: "R34lBAdP455LONGLONGLONGLONG",
RootPass: randPassword(),
Size: 2000,
})
if err != nil {
Expand Down Expand Up @@ -221,7 +221,7 @@ func TestInstance_Disk_ResetPassword(t *testing.T) {
Label: "go-disk-test-" + randLabel(),
Filesystem: "ext4",
Image: "linode/debian9",
RootPass: "R34lBAdP455LONGLONGLONGLONG",
RootPass: randPassword(),
Size: 2000,
})
if err != nil {
Expand Down Expand Up @@ -329,7 +329,7 @@ func TestInstance_Rebuild(t *testing.T) {
Metadata: &linodego.InstanceMetadataOptions{
UserData: base64.StdEncoding.EncodeToString([]byte("cool")),
},
RootPass: "R34lBAdP455LONGLONGLONGLONG",
RootPass: randPassword(),
Type: "g6-standard-2",
}
instance, err = client.RebuildInstance(context.Background(), instance.ID, rebuildOpts)
Expand Down Expand Up @@ -451,7 +451,7 @@ func createInstance(t *testing.T, client *linodego.Client, modifiers ...instance
booted := false
createOpts := linodego.InstanceCreateOptions{
Label: "go-test-ins-" + randLabel(),
RootPass: "R34lBAdP455LONGLONGLONGLONG",
RootPass: randPassword(),
Region: getRegionsWithCaps(t, client, []string{"linodes"})[0],
Type: "g6-nanode-1",
Image: "linode/debian9",
Expand Down
4 changes: 2 additions & 2 deletions test/integration/waitfor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestEventPoller_InstancePower(t *testing.T) {
Region: getRegionsWithCaps(t, client, []string{"Linodes"})[0],
Type: "g6-nanode-1",
Image: "linode/ubuntu22.04",
RootPass: "R34lBAdP455LONGLONGLONGLONG",
RootPass: randPassword(),
Label: "go-ins-poll-test",
Booted: &booted,
})
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestWaitForResourceFree(t *testing.T) {
Region: getRegionsWithCaps(t, client, []string{"Linodes"})[0],
Type: "g6-nanode-1",
Image: "linode/ubuntu22.04",
RootPass: "c00lp@sgfdgregrhn$!!!!",
RootPass: randPassword(),
Label: "linodego-waitforfree",
})
if err != nil {
Expand Down

0 comments on commit d853175

Please sign in to comment.