-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package e2e | ||
|
||
import ( | ||
"os" | ||
"regexp" | ||
|
||
e2etests "github.com/aws/eks-anywhere/test/framework" | ||
) | ||
|
||
func (e *E2ESession) setupOOBEnv(testRegex string) error { | ||
re := regexp.MustCompile(`^.*OOB.*$`) | ||
if !re.MatchString(testRegex) { | ||
return nil | ||
} | ||
|
||
requiredEnvVars := e2etests.RequiredOOBEnvVars() | ||
for _, eVar := range requiredEnvVars { | ||
if val, ok := os.LookupEnv(eVar); ok { | ||
e.testEnvVars[eVar] = val | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package e2e | ||
|
||
import ( | ||
"github.com/aws/eks-anywhere/pkg/api/v1alpha1" | ||
"github.com/aws/eks-anywhere/test/framework" | ||
) | ||
|
||
func runOOBConfigFlow(test *framework.ClusterE2ETest) { | ||
test.GenerateClusterConfig() | ||
test.GenerateHardwareConfig() | ||
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m")) | ||
test.DeleteCluster() | ||
test.PowerOffHardware() | ||
test.ValidateHardwareDecommissioned() | ||
} | ||
|
||
func runOOBConfigUpgradeFlow(test *framework.ClusterE2ETest, updateVersion v1alpha1.KubernetesVersion, clusterOpts ...framework.ClusterE2ETestOpt) { | ||
test.GenerateClusterConfig() | ||
test.GenerateHardwareConfig() | ||
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m")) | ||
test.UpgradeClusterWithNewConfig(clusterOpts) | ||
test.ValidateCluster(updateVersion) | ||
test.StopIfFailed() | ||
test.DeleteCluster() | ||
test.ValidateHardwareDecommissioned() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package framework | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
const ( | ||
// oob related stuff | ||
tinkerbellBMCConsumerURL = "T_TINKERBELL_BMC_CONSUMER_URL" | ||
tinkerbellBMCHMACSecret = "T_TINKERBELL_BMC_HMAC_SECRETS" | ||
tinkerbellBMCTimestampHeader = "T_TINKERBELL_BMC_TIMESTAMP_HEADER" | ||
tinkerbellBMCIncludedPayloadHeaders = "T_TINKERBELL_BMC_INCLUDED_PAYLOAD_HEADERS" | ||
) | ||
|
||
var requiredOOBEnvVars = []string{ | ||
tinkerbellBMCConsumerURL, | ||
tinkerbellBMCHMACSecret, | ||
tinkerbellBMCTimestampHeader, | ||
tinkerbellBMCIncludedPayloadHeaders, | ||
} | ||
|
||
func RequiredOOBEnvVars() []string { | ||
return requiredOOBEnvVars | ||
} | ||
|
||
func WithOOBConfiguration() ClusterE2ETestOpt { | ||
return func(e *ClusterE2ETest) { | ||
checkRequiredEnvVars(e.T, requiredOOBEnvVars) | ||
consumerURL := os.Getenv(tinkerbellBMCConsumerURL) | ||
HMACSecret := os.Getenv(tinkerbellBMCHMACSecret) | ||
timestampHeader := os.Getenv(tinkerbellBMCTimestampHeader) | ||
includedPayloadHeaders := os.Getenv(tinkerbellBMCIncludedPayloadHeaders) | ||
err := os.Setenv("TINKERBELL_BMC_CONSUMER_URL", consumerURL) | ||
if err != nil { | ||
e.T.Fatalf("unable to set TINKERBELL_BMC_CONSUMER_URL: %v", err) | ||
} | ||
err = os.Setenv("TINKERBELL_BMC_HMAC_SECRETS", HMACSecret) | ||
if err != nil { | ||
e.T.Fatalf("unable to set TINKERBELL_BMC_HMAC_SECRETS: %v", err) | ||
} | ||
err = os.Setenv("TINKERBELL_BMC_TIMESTAMP_HEADER", timestampHeader) | ||
if err != nil { | ||
e.T.Fatalf("unable to set TINKERBELL_BMC_TIMESTAMP_HEADER: %v", err) | ||
} | ||
err = os.Setenv("TINKERBELL_BMC_INCLUDED_PAYLOAD_HEADERS", includedPayloadHeaders) | ||
if err != nil { | ||
e.T.Fatalf("unable to set TINKERBELL_BMC_INCLUDED_PAYLOAD_HEADERS: %v", err) | ||
} | ||
|
||
e.WithOOBConfiguration = true | ||
} | ||
} |