mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-03 23:04:53 -04:00
ci: add e2e test for constellation recover (#845)
* AB#2256 Add recover e2e test * AB#2256 move test & fix minor objections * AB#2256 fix path * AB#2256 rename hacky filename
This commit is contained in:
parent
2cee7cb454
commit
ae2db08f3a
14 changed files with 202 additions and 32 deletions
|
@ -74,39 +74,59 @@ func (c *Client) PrepareWorkspace(path string, vars Variables) error {
|
|||
}
|
||||
|
||||
// CreateCluster creates a Constellation cluster using Terraform.
|
||||
func (c *Client) CreateCluster(ctx context.Context) (string, string, error) {
|
||||
func (c *Client) CreateCluster(ctx context.Context) (CreateOutput, error) {
|
||||
if err := c.tf.Init(ctx); err != nil {
|
||||
return "", "", err
|
||||
return CreateOutput{}, err
|
||||
}
|
||||
|
||||
if err := c.tf.Apply(ctx); err != nil {
|
||||
return "", "", err
|
||||
return CreateOutput{}, err
|
||||
}
|
||||
|
||||
tfState, err := c.tf.Show(ctx)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
return CreateOutput{}, err
|
||||
}
|
||||
|
||||
ipOutput, ok := tfState.Values.Outputs["ip"]
|
||||
if !ok {
|
||||
return "", "", errors.New("no IP output found")
|
||||
return CreateOutput{}, errors.New("no IP output found")
|
||||
}
|
||||
ip, ok := ipOutput.Value.(string)
|
||||
if !ok {
|
||||
return "", "", errors.New("invalid type in IP output: not a string")
|
||||
return CreateOutput{}, errors.New("invalid type in IP output: not a string")
|
||||
}
|
||||
|
||||
secretOutput, ok := tfState.Values.Outputs["initSecret"]
|
||||
if !ok {
|
||||
return "", "", errors.New("no initSecret output found")
|
||||
return CreateOutput{}, errors.New("no initSecret output found")
|
||||
}
|
||||
secret, ok := secretOutput.Value.(string)
|
||||
if !ok {
|
||||
return "", "", errors.New("invalid type in initSecret output: not a string")
|
||||
return CreateOutput{}, errors.New("invalid type in initSecret output: not a string")
|
||||
}
|
||||
|
||||
return ip, secret, nil
|
||||
uidOutput, ok := tfState.Values.Outputs["uid"]
|
||||
if !ok {
|
||||
return CreateOutput{}, errors.New("no uid output found")
|
||||
}
|
||||
uid, ok := uidOutput.Value.(string)
|
||||
if !ok {
|
||||
return CreateOutput{}, errors.New("invalid type in uid output: not a string")
|
||||
}
|
||||
|
||||
return CreateOutput{
|
||||
IP: ip,
|
||||
Secret: secret,
|
||||
UID: uid,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateOutput contains the Terraform output values of a cluster creation.
|
||||
type CreateOutput struct {
|
||||
IP string
|
||||
Secret string
|
||||
UID string
|
||||
}
|
||||
|
||||
// IAMOutput contains the output information of the Terraform IAM operations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue