Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 1 | // SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> |
| 2 | // |
Sean Condon | 160ec1d | 2022-02-08 12:58:25 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: Apache-2.0 |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 4 | |
| 5 | package tests |
| 6 | |
| 7 | import ( |
| 8 | "context" |
| 9 | "testing" |
| 10 | "time" |
| 11 | |
| 12 | "github.com/onosproject/helmit/pkg/helm" |
| 13 | "github.com/onosproject/helmit/pkg/input" |
| 14 | "github.com/onosproject/helmit/pkg/kubernetes" |
| 15 | "github.com/onosproject/helmit/pkg/test" |
| 16 | "github.com/onosproject/onos-test/pkg/onostest" |
| 17 | "github.com/stretchr/testify/assert" |
| 18 | ) |
| 19 | |
Sean Condon | af0eb3c | 2021-09-19 20:14:29 +0100 | [diff] [blame] | 20 | const aetherCharts = "https://charts.aetherproject.org/" |
| 21 | |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 22 | // AetherRocUmbrellaSuite is the aether-roc-umbrella chart test suite |
| 23 | type AetherRocUmbrellaSuite struct { |
| 24 | test.Suite |
| 25 | c *input.Context |
| 26 | } |
| 27 | |
| 28 | // SetupTestSuite sets up the aether roc umbrella test suite |
| 29 | func (s *AetherRocUmbrellaSuite) SetupTestSuite(c *input.Context) error { |
| 30 | s.c = c |
| 31 | return nil |
| 32 | } |
| 33 | |
| 34 | func getCredentials() (string, string, error) { |
| 35 | kubClient, err := kubernetes.New() |
| 36 | if err != nil { |
| 37 | return "", "", err |
| 38 | } |
| 39 | secrets, err := kubClient.CoreV1().Secrets().Get(context.Background(), onostest.SecretsName) |
| 40 | if err != nil { |
| 41 | return "", "", err |
| 42 | } |
| 43 | username := string(secrets.Object.Data["sd-ran-username"]) |
| 44 | password := string(secrets.Object.Data["sd-ran-password"]) |
| 45 | |
| 46 | return username, password, nil |
| 47 | } |
| 48 | |
| 49 | // TestInstall tests installing the aether-roc-umbrella chart |
| 50 | func (s *AetherRocUmbrellaSuite) TestInstall(t *testing.T) { |
| 51 | username, password, err := getCredentials() |
| 52 | assert.NoError(t, err) |
| 53 | registry := s.c.GetArg("registry").String("") |
| 54 | |
Sean Condon | af0eb3c | 2021-09-19 20:14:29 +0100 | [diff] [blame] | 55 | onos := helm.Chart("aether-roc-umbrella", aetherCharts). |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 56 | Release("aether-roc-umbrella"). |
| 57 | SetUsername(username). |
| 58 | SetPassword(password). |
| 59 | WithTimeout(15*time.Minute). |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 60 | Set("import.onos-gui.enabled", false). |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 61 | Set("import.aether-roc-gui.v3.enabled", false). |
Sean Condon | c7d8914 | 2021-10-21 11:18:08 +0100 | [diff] [blame] | 62 | Set("import.aether-roc-gui.v4.enabled", true). |
Sean Condon | 4cad87a | 2021-10-27 08:19:13 +0100 | [diff] [blame] | 63 | Set("import.sdcore-adapter.v3.enabled", true). |
| 64 | Set("import.sdcore-adapter.v4.enabled", true). |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 65 | Set("import.onos-cli.enabled", false). |
Sean Condon | 0246661 | 2021-10-22 17:08:25 +0100 | [diff] [blame] | 66 | Set("import.prometheus.acc.enabled", false). |
| 67 | Set("aether-roc-gui-v4.prometheus.acc.proxyEnabled", false). |
| 68 | Set("import.prometheus.amp.enabled", false). |
| 69 | Set("aether-roc-gui-v4.prometheus.amp.proxyEnabled", false). |
| 70 | Set("import.prometheus.ace.enabled", false). |
| 71 | Set("aether-roc-gui-v4.prometheus.site", nil). |
| 72 | Set("import.grafana.enabled", false). |
| 73 | Set("aether-roc-gui-v4.grafana.enabled", false). |
| 74 | Set("aether-roc-gui-v4.grafana.proxyEnabled", false). |
Sean Condon | c7d8914 | 2021-10-21 11:18:08 +0100 | [diff] [blame] | 75 | Set("aether-roc-gui-v4.service.type", "NodePort"). |
Scott Baker | 6965439 | 2021-09-17 13:50:16 -0700 | [diff] [blame] | 76 | Set("onos-config.plugin.compiler.target", "github.com/onosproject/onos-config@master"). |
| 77 | Set("global.image.registry", registry) |
| 78 | assert.NoError(t, onos.Install(true)) |
| 79 | } |