This repository has been archived by the owner on Mar 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
spec.go
80 lines (69 loc) · 1.79 KB
/
spec.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
package basicapp
import (
"context"
"github.com/giantswarm/microerror"
"k8s.io/client-go/kubernetes"
)
type Clients interface {
// K8sClient returns a properly configured control plane client for the
// Kubernetes API.
K8sClient() kubernetes.Interface
}
// Chart is the chart to test.
type Chart struct {
Name string
URL string
ChartValues string
Namespace string
RunReleaseTests bool
}
func (cc Chart) Validate() error {
if cc.URL == "" {
return microerror.Maskf(invalidConfigError, "%T.URL must not be empty", cc)
}
if cc.Name == "" {
return microerror.Maskf(invalidConfigError, "%T.Name must not be empty", cc)
}
if cc.Namespace == "" {
return microerror.Maskf(invalidConfigError, "%T.Namespace must not be empty", cc)
}
return nil
}
// ChartResources are the key resources deployed by the chart.
type ChartResources struct {
DaemonSets []DaemonSet
Deployments []Deployment
Services []Service
}
// DaemonSet is a daemonset to be tested.
type DaemonSet struct {
Name string
Namespace string
Labels map[string]string
MatchLabels map[string]string
}
// Deployment is a deployment to be tested.
type Deployment struct {
Name string
Namespace string
DeploymentLabels map[string]string
MatchLabels map[string]string
PodLabels map[string]string
}
// Service is a service to be tested.
type Service struct {
Name string
Namespace string
Labels map[string]string
}
type Interface interface {
// Test executes the test of a managed services chart with basic
// functionality that applies to all managed services charts.
//
// - Install chart.
// - Check chart is deployed.
// - Check key resources are correct.
// - Run helm release tests if configured.
//
Test(ctx context.Context) error
}