Skip to content

Commit

Permalink
Refactor common strings for names and repos; Use per-test names for a…
Browse files Browse the repository at this point in the history
…tomix controllers
  • Loading branch information
ray-milkey committed Aug 10, 2020
1 parent 9ffc63f commit 5785b96
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 24 deletions.
25 changes: 16 additions & 9 deletions benchmark/gnmi/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,40 @@ type BenchmarkSuite struct {
value input.Source
}

const (
atomixChartRepo = "https://charts.atomix.io"
onosChartRepo = "https://charts.onosproject.org"
atomixName = "cli-test-onos-config-atomix"
atomixControllerName = atomixName + "-" + "kubernetes-controller"
atomixControllerPort = "5679"
atomixController = atomixControllerName + ":" + atomixControllerPort
)

// SetupSuite :: benchmark
func (s *BenchmarkSuite) SetupSuite(c *benchmark.Context) error {
// Setup the Atomix controller
err := helm.Chart("kubernetes-controller", "https://charts.atomix.io").
Release("onos-config-atomix").
err := helm.Chart("kubernetes-controller", atomixChartRepo).
Release(atomixName).
Set("scope", "Namespace").
Install(true)
if err != nil {
return err
}

err = helm.Chart("raft-storage-controller", "https://charts.atomix.io").
err = helm.Chart("raft-storage-controller", atomixChartRepo).
Release("onos-config-raft").
Set("scope", "Namespace").
Install(true)
if err != nil {
return err
}

controller := "onos-config-atomix-kubernetes-controller:5679"

// Install the onos-topo chart
err = helm.
Chart("onos-topo").
Chart("onos-topo", onosChartRepo).
Release("onos-topo").
Set("replicaCount", 2).
Set("storage.controller", controller).
Set("storage.controller", atomixController).
Set("image.tag", "latest").
Install(false)
if err != nil {
Expand All @@ -71,10 +78,10 @@ func (s *BenchmarkSuite) SetupSuite(c *benchmark.Context) error {

// Install the onos-config chart
err = helm.
Chart("onos-config").
Chart("onos-config", onosChartRepo).
Release("onos-config").
Set("replicaCount", 2).
Set("storage.controller", controller).
Set("storage.controller", atomixController).
Set("image.tag", "latest").
Install(true)
if err != nil {
Expand Down
25 changes: 17 additions & 8 deletions test/cli/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,52 @@ type TestSuite struct {
testSuite
}

const (
atomixChartRepo = "https://charts.atomix.io"
onosChartRepo = "https://charts.onosproject.org"
atomixName = "cli-test-onos-config-atomix"
atomixControllerName = atomixName + "-" + "kubernetes-controller"
atomixControllerPort = "5679"
atomixController = atomixControllerName + ":" + atomixControllerPort
)

// SetupTestSuite sets up the onos-config CLI test suite
func (s *TestSuite) SetupTestSuite() error {
err := helm.Chart("kubernetes-controller", "https://charts.atomix.io").
Release("onos-config-atomix").
err := helm.Chart("kubernetes-controller", atomixChartRepo).
Release(atomixName).
Set("scope", "Namespace").
Install(true)
if err != nil {
return err
}

err = helm.Chart("raft-storage-controller", "https://charts.atomix.io").
err = helm.Chart("raft-storage-controller", atomixChartRepo).
Release("onos-config-raft").
Set("scope", "Namespace").
Install(true)
if err != nil {
return err
}

err = helm.Chart("onos-topo", "https://charts.onosproject.org").
err = helm.Chart("onos-topo", onosChartRepo).
Release("onos-topo").
Set("image.tag", "latest").
Set("storage.controller", "onos-config-atomix-kubernetes-controller:5679").
Set("storage.controller", atomixController).
Install(true)
if err != nil {
return err
}

err = helm.Chart("onos-config", "https://charts.onosproject.org").
err = helm.Chart("onos-config", onosChartRepo).
Release("onos-config").
Set("image.tag", "latest").
Set("storage.controller", "onos-config-atomix-kubernetes-controller:5679").
Set("storage.controller", atomixController).
Install(true)
if err != nil {
return err
}

err = helm.Chart("onos-cli", "https://charts.onosproject.org").
err = helm.Chart("onos-cli", onosChartRepo).
Release("onos-cli").
Set("image.tag", "latest").
Install(true)
Expand Down
23 changes: 16 additions & 7 deletions test/gnmi/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,46 @@ type TestSuite struct {
testSuite
}

const (
atomixChartRepo = "https://charts.atomix.io"
onosChartRepo = "https://charts.onosproject.org"
atomixName = "cli-test-onos-config-atomix"
atomixControllerName = atomixName + "-" + "kubernetes-controller"
atomixControllerPort = "5679"
atomixController = atomixControllerName + ":" + atomixControllerPort
)

// SetupTestSuite sets up the onos-config CLI test suite
func (s *TestSuite) SetupTestSuite() error {
err := helm.Chart("kubernetes-controller", "https://charts.atomix.io").
Release("onos-config-atomix").
err := helm.Chart("kubernetes-controller", atomixChartRepo).
Release(atomixName).
Set("scope", "Namespace").
Install(true)
if err != nil {
return err
}

err = helm.Chart("raft-storage-controller", "https://charts.atomix.io").
err = helm.Chart("raft-storage-controller", atomixChartRepo).
Release("onos-config-raft").
Set("scope", "Namespace").
Install(true)
if err != nil {
return err
}

err = helm.Chart("onos-topo", "https://charts.onosproject.org").
err = helm.Chart("onos-topo", onosChartRepo).
Release("onos-topo").
Set("image.tag", "latest").
Set("storage.controller", "onos-config-atomix-kubernetes-controller:5679").
Set("storage.controller", atomixController).
Install(true)
if err != nil {
return err
}

err = helm.Chart("onos-config", "https://charts.onosproject.org").
err = helm.Chart("onos-config", onosChartRepo).
Release("onos-config").
Set("image.tag", "latest").
Set("storage.controller", "onos-config-atomix-kubernetes-controller:5679").
Set("storage.controller", atomixController).
Install(true)
if err != nil {
return err
Expand Down

0 comments on commit 5785b96

Please sign in to comment.