/
types.go
72 lines (52 loc) · 1.9 KB
/
types.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
package templatertesting
import (
"testing"
"github.com/jenkins-x-plugins/secretfacade/pkg/secretstore"
jxcore "github.com/jenkins-x/jx-api/v4/pkg/apis/core/v4beta1"
v1 "github.com/jenkins-x/jx-secret/pkg/apis/external/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// Runner runs the test harness
type Runner struct {
// TestCases the test cases to run
TestCases []TestCase
// SchemaFile the schema file to load for the templates
SchemaFile string
// Namespace optional namespace - defaults to 'jx'
Namespace string
// Dir the directory used to detect the jx-requirements.yml file if none is supplied on the test case
Dir string
// KubeObjects so you can define default secrets
KubeObjects []runtime.Object
}
type ExternalSecret struct {
Location string
Name string
Value secretstore.SecretValue
ExternalSecret v1.ExternalSecret
}
// TestCase represents a test case
type TestCase struct {
// GenerateTestOutput to regenerate the expected output
GenerateTestOutput bool
// ObjectName name of the object in the schema
ObjectName string
// Property name to render; this name is used to find the template in the schema
Property string
// TestName is the name of the test
TestName string
// ExpectedFile expected file name to compare the generated results against
ExpectedFile string
// Format the text format of the output used to perform additional validation
Format string
// Dir the directory used to detect the jx-requirements.yml file if none is supplied
Dir string
// Requirements the jx-requirements.yml used to parameterize the template
Requirements *jxcore.RequirementsConfig
// KubeObjects extra kubernetes resources such as Secrets for the test case
KubeObjects []runtime.Object
// VerifyFn performs a custom verify of the generated value
VerifyFn func(*testing.T, string)
ExternalSecrets []ExternalSecret
ExternalSecretStorageType secretstore.SecretStoreType
}