blob: b64786a56ed9ae3cca18e6b7ff86e2db58e50a5c [file] [log] [blame]
Scott Baker69654392021-09-17 13:50:16 -07001// SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
2//
3// SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
4
5package tests
6
7import (
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 Condonaf0eb3c2021-09-19 20:14:29 +010020const aetherCharts = "https://charts.aetherproject.org/"
21
Scott Baker69654392021-09-17 13:50:16 -070022// AetherRocUmbrellaSuite is the aether-roc-umbrella chart test suite
23type AetherRocUmbrellaSuite struct {
24 test.Suite
25 c *input.Context
26}
27
28// SetupTestSuite sets up the aether roc umbrella test suite
29func (s *AetherRocUmbrellaSuite) SetupTestSuite(c *input.Context) error {
30 s.c = c
31 return nil
32}
33
34func 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
50func (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 Condonaf0eb3c2021-09-19 20:14:29 +010055 onos := helm.Chart("aether-roc-umbrella", aetherCharts).
Scott Baker69654392021-09-17 13:50:16 -070056 Release("aether-roc-umbrella").
57 SetUsername(username).
58 SetPassword(password).
59 WithTimeout(15*time.Minute).
Scott Baker69654392021-09-17 13:50:16 -070060 Set("import.onos-gui.enabled", false).
Scott Baker69654392021-09-17 13:50:16 -070061 Set("import.aether-roc-gui.v3.enabled", false).
Sean Condonc7d89142021-10-21 11:18:08 +010062 Set("import.aether-roc-gui.v4.enabled", true).
Scott Baker69654392021-09-17 13:50:16 -070063 Set("import.onos-cli.enabled", false).
64 Set("onos-topo.image.tag", "latest").
65 Set("onos-config.image.tag", "latest").
66 Set("aether-roc-api.image.tag", "latest").
Sean Condonc7d89142021-10-21 11:18:08 +010067 Set("aether-roc-websocket.image.tag", "latest").
68 Set("subscriber-proxy.image.tag", "latest").
69 Set("prom-label-proxy.image.tag", "latest").
70 //Set("sdcore-adapter-v4.image.tag", "latest").
71 Set("aether-roc-gui-v4.image.tag", "latest").
72 Set("aether-roc-gui-v4.ingress.enabled", false).
73 Set("aether-roc-gui-v4.service.type", "NodePort").
Scott Baker69654392021-09-17 13:50:16 -070074 Set("onos-config.plugin.compiler.target", "github.com/onosproject/onos-config@master").
75 Set("global.image.registry", registry)
76 assert.NoError(t, onos.Install(true))
77}