Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Jenkins soak tests (#2028)
Browse files Browse the repository at this point in the history
* added soak test

* added soak test name

* add location to name

* delete rg if re-provisioning cluster

* fix typo

* added wait flag

* fix no wait arg

* add err log

* remove ssh key

* remove unused vars

* Revert "remove ssh key"

This reverts commit 9041c1a.

* terminology

* delete files if deployment failed

* remove soak test spec

* Pass in soak cluster name

* only generate ssh key once

* add default for KeyGenerated

* fix typo

* Do not generate SSH for soak test

* fix typo in comment

* add dashboard test debug log

* Revert "add dashboard test debug log"

This reverts commit 4937282.
  • Loading branch information
Cecile Robert-Michon authored and jackfrancis committed Jan 18, 2018
1 parent ab9e35b commit b1b6dde
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
12 changes: 9 additions & 3 deletions test/e2e/azure/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,15 @@ func (a *Account) CreateGroup(name, location string) error {
return nil
}

// DeleteGroup delets a given resource group by name
func (a *Account) DeleteGroup(name string) error {
out, err := exec.Command("az", "group", "delete", "--name", name, "--no-wait", "--yes").CombinedOutput()
// DeleteGroup deletes a given resource group by name
func (a *Account) DeleteGroup(name string, wait bool) error {
var out []byte
var err error
if !wait {
out, err = exec.Command("az", "group", "delete", "--name", name, "--no-wait", "--yes").CombinedOutput()
} else {
out, err = exec.Command("az", "group", "delete", "--name", name, "--yes").CombinedOutput()
}
if err != nil {
log.Printf("Error while trying to delete resource group (%s):%s", name, out)
return err
Expand Down
1 change: 1 addition & 0 deletions test/e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Config struct {
CleanUpOnExit bool `envconfig:"CLEANUP_ON_EXIT" default:"true"` // if set the tests will not clean up rgs when tests finish
Timeout time.Duration `envconfig:"TIMEOUT" default:"10m"`
CurrentWorkingDir string
SoakClusterName string `envconfig:"SOAK_CLUSTER_NAME"`
}

const (
Expand Down
7 changes: 6 additions & 1 deletion test/e2e/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func main() {

// Only provision a cluster if there isnt a name present
if cfg.Name == "" {
if cfg.SoakClusterName != "" {
rg := cfg.SoakClusterName
log.Printf("Deleting Group:%s\n", rg)
acct.DeleteGroup(rg, true)
}
cliProvisioner, err := runner.BuildCLIProvisioner(cfg, acct, pt)
if err != nil {
log.Fatalf("Error while trying to build CLI Provisioner:%s", err)
Expand Down Expand Up @@ -118,7 +123,7 @@ func teardown() {
if cfg.CleanUpOnExit {
for _, rg := range rgs {
log.Printf("Deleting Group:%s\n", rg)
acct.DeleteGroup(rg)
acct.DeleteGroup(rg, false)
}
}
}
15 changes: 10 additions & 5 deletions test/e2e/runner/cli_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (cli *CLIProvisioner) Run() error {
cli.Point.RecordProvisionError()
} else if i == cli.ProvisionRetries {
cli.Point.RecordProvisionError()
return fmt.Errorf("Exceeded provision retry count")
return fmt.Errorf("Exceeded provision retry count: %s", err)
}
} else {
cli.Point.RecordProvisionSuccess()
Expand All @@ -76,17 +76,22 @@ func (cli *CLIProvisioner) Run() error {

func (cli *CLIProvisioner) provision() error {
cli.Config.Name = cli.generateName()
if cli.Config.SoakClusterName != "" {
cli.Config.Name = cli.Config.SoakClusterName
}
os.Setenv("NAME", cli.Config.Name)
log.Printf("Cluster name:%s\n", cli.Config.Name)

outputPath := filepath.Join(cli.Config.CurrentWorkingDir, "_output")
os.Mkdir(outputPath, 0755)

out, err := exec.Command("ssh-keygen", "-f", cli.Config.GetSSHKeyPath(), "-q", "-N", "", "-b", "2048", "-t", "rsa").CombinedOutput()
if err != nil {
return fmt.Errorf("Error while trying to generate ssh key:%s\nOutput:%s", err, out)
if cli.Config.SoakClusterName == "" {
out, err := exec.Command("ssh-keygen", "-f", cli.Config.GetSSHKeyPath(), "-q", "-N", "", "-b", "2048", "-t", "rsa").CombinedOutput()
if err != nil {
return fmt.Errorf("Error while trying to generate ssh key:%s\nOutput:%s", err, out)
}
exec.Command("chmod", "0600", cli.Config.GetSSHKeyPath()+"*")
}
exec.Command("chmod", "0600", cli.Config.GetSSHKeyPath()+"*")

publicSSHKey, err := cli.Config.ReadPublicSSHKey()
if err != nil {
Expand Down

0 comments on commit b1b6dde

Please sign in to comment.