This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapp_polaris-reporting.go
83 lines (73 loc) · 1.87 KB
/
app_polaris-reporting.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package testutils
import (
"log"
reporting "github.com/blackducksoftware/synopsysctl/pkg/polaris-reporting"
"github.com/blackducksoftware/synopsysctl/pkg/util"
)
// GetLatestPolarisReportingVersion ...
func GetLatestPolarisReportingVersion() string {
if TestConfig.PolarisReporting.Version != "" {
return TestConfig.PolarisReporting.Version
}
return "2020.04"
}
// GetPolarisReportingServiceAccountPath ...
func GetPolarisReportingServiceAccountPath() string {
if TestConfig.PolarisReporting.ServiceAccountPath != "" {
return TestConfig.PolarisReporting.ServiceAccountPath
}
return GetMockServiceAccount()
}
// NewPolarisReportingTester ...
func NewPolarisReportingTester() *PolarisReportingTester {
t := PolarisReportingTester{
AppName: "polaris-reporting",
}
// Get default values for an Polaris-Reporting test
t.Namespace = CreateUniqueNamespace(t.AppName)
t.Version = GetLatestPolarisReportingVersion()
t.Labels = ""
// Config for Polaris Reporting
t.FlagTree = reporting.FlagTree{}
return &t
}
// PolarisReportingTester ...
type PolarisReportingTester struct {
AppName string
Namespace string
Version string
Labels string
FlagTree reporting.FlagTree
}
// WaitUntilReady ...
func (t PolarisReportingTester) WaitUntilReady() {
err := util.WaitForPodsToAppear(KubeClient, t.Namespace, t.Labels)
if err != nil {
log.Fatalf("%+v", err)
}
util.WaitForPodsToBeRunningOrComplete(KubeClient, t.Namespace, t.Labels)
if err != nil {
log.Fatalf("%+v", err)
}
util.WaitForPodsToStopTerminating(KubeClient, t.Namespace)
if err != nil {
log.Fatalf("%+v", err)
}
}
// Verify ...
func (t PolarisReportingTester) Verify() error {
checks := []func() error{
t.checkSomething,
}
var err error
for _, check := range checks {
err = check()
if err != nil {
return err
}
}
return nil
}
func (t PolarisReportingTester) checkSomething() error {
return nil
}