blob: 799d41dbd936d8f007919da91e15faf4b942ebbe [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
20// AetherRocUmbrellaSuite is the aether-roc-umbrella chart test suite
21type AetherRocUmbrellaSuite struct {
22 test.Suite
23 c *input.Context
24}
25
26// SetupTestSuite sets up the aether roc umbrella test suite
27func (s *AetherRocUmbrellaSuite) SetupTestSuite(c *input.Context) error {
28 s.c = c
29 return nil
30}
31
32func getCredentials() (string, string, error) {
33 kubClient, err := kubernetes.New()
34 if err != nil {
35 return "", "", err
36 }
37 secrets, err := kubClient.CoreV1().Secrets().Get(context.Background(), onostest.SecretsName)
38 if err != nil {
39 return "", "", err
40 }
41 username := string(secrets.Object.Data["sd-ran-username"])
42 password := string(secrets.Object.Data["sd-ran-password"])
43
44 return username, password, nil
45}
46
47// TestInstall tests installing the aether-roc-umbrella chart
48func (s *AetherRocUmbrellaSuite) TestInstall(t *testing.T) {
49 username, password, err := getCredentials()
50 assert.NoError(t, err)
51 registry := s.c.GetArg("registry").String("")
52
53 onos := helm.Chart("aether-roc-umbrella", onostest.SdranChartRepo).
54 Release("aether-roc-umbrella").
55 SetUsername(username).
56 SetPassword(password).
57 WithTimeout(15*time.Minute).
58 Set("onos-ric.service.external.nodePort", 0).
59 Set("onos-ric-ho.service.external.nodePort", 0).
60 Set("onos-ric-mlb.service.external.nodePort", 0).
61 Set("import.onos-gui.enabled", false).
62 Set("import.aether-roc-gui.v2_1.enabled", false).
63 Set("import.aether-roc-gui.v3.enabled", false).
64 Set("import.onos-cli.enabled", false).
65 Set("onos-topo.image.tag", "latest").
66 Set("onos-config.image.tag", "latest").
67 Set("aether-roc-api.image.tag", "latest").
68 Set("onos-config.plugin.compiler.target", "github.com/onosproject/onos-config@master").
69 Set("global.image.registry", registry)
70 assert.NoError(t, onos.Install(true))
71}