forked from openshift/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
81 lines (65 loc) · 3.44 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
73
74
75
76
77
78
79
80
81
package tests
// SuiteSpec defines a test suite specification.
type SuiteSpec struct {
// Name is the name of the test suite.
Name string `json:"name"`
// CRD is a CRD file path that should be installed as a part of this test.
CRD string `json:"crd"`
// Version is the version of the CRD under test in this file.
// When omitted, if there is a single version in the CRD, this is assumed to be the correct version.
// If there are multiple versions within the CRD, an educated guess is made based on the directory structure.
Version string `json:"version,omitempty"`
// Tests defines the test cases to run for this test suite.
Tests TestSpec `json:"tests"`
}
// TestSpec defines the test specs for individual tests in this suite.
type TestSpec struct {
// OnCreate defines a list of on create style tests.
OnCreate []OnCreateTestSpec `json:"onCreate"`
// OnUpdate defines a list of on create style tests.
OnUpdate []OnUpdateTestSpec `json:"onUpdate"`
}
// OnCreateTestSpec defines an individual test case for the on create style tests.
type OnCreateTestSpec struct {
// Name is the name of this test case.
Name string `json:"name"`
// Initial is a literal string containing the initial YAML content from which to
// create the resource.
// Note `apiVersion` and `kind` fields are required though `metadata` can be omitted.
// Typically this will vary in `spec` only test to test.
Initial string `json:"initial"`
// ExpectedError defines the error string that should be returned when the initial resourec is invalid.
// This will be matched as a substring of the actual error when non-empty.
ExpectedError string `json:"expectedError"`
// Expected is a literal string containing the expected YAML content that should be
// persisted when the resource is created.
// Note `apiVersion` and `kind` fields are required though `metadata` can be omitted.
// Typically this will vary in `spec` only test to test.
Expected string `json:"expected"`
}
// OnUpdateTestSpec defines an individual test case for the on update style tests.
type OnUpdateTestSpec struct {
// Name is the name of this test case.
Name string `json:"name"`
// Initial is a literal string containing the initial YAML content from which to
// create the resource.
// Note `apiVersion` and `kind` fields are required though `metadata` can be omitted.
// Typically this will vary in `spec` only test to test.
Initial string `json:"initial"`
// Updated is a literal string containing the updated YAML content from which to
// update the resource.
// Note `apiVersion` and `kind` fields are required though `metadata` can be omitted.
// Typically this will vary in `spec` only test to test.
Updated string `json:"updated"`
// ExpectedError defines the error string that should be returned when the updated resource is invalid.
// This will be matched as a substring of the actual error when non-empty.
ExpectedError string `json:"expectedError"`
// ExpectedStatusError defines the error string that should be returned when the updated resource status is invalid.
// This will be matched as a substring of the actual error when non-empty.
ExpectedStatusError string `json:"expectedStatusError"`
// Expected is a literal string containing the expected YAML content that should be
// persisted when the resource is updated.
// Note `apiVersion` and `kind` fields are required though `metadata` can be omitted.
// Typically this will vary in `spec` only test to test.
Expected string `json:"expected"`
}