File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change
1
+ changelog :
2
+ - type : NON_USER_FACING
3
+ description : |
4
+ Introducing TestInstallation.AssertionsT method that provides a better
5
+ scoped assertions provider.
Original file line number Diff line number Diff line change @@ -108,9 +108,8 @@ func (s *k8sServerTlsTestingSuite) TestOneWayServerTlsWorksWithOneWayTls() {
108
108
}
109
109
110
110
func (s * k8sServerTlsTestingSuite ) assertEventualResponse (hostHeaderValue string , matcher * matchers.HttpResponse ) {
111
-
112
111
// Check curl works against expected response
113
- s .testInstallation .Assertions .AssertEventualCurlResponse (
112
+ s .testInstallation .AssertionsT ( s . T ()) .AssertEventualCurlResponse (
114
113
s .ctx ,
115
114
kubectl.PodExecOptions {
116
115
Name : "curl" ,
@@ -123,7 +122,7 @@ func (s *k8sServerTlsTestingSuite) assertEventualResponse(hostHeaderValue string
123
122
124
123
func (s * k8sServerTlsTestingSuite ) assertEventualError (hostHeaderValue string , code int ) {
125
124
// Check curl works against expected response
126
- s .testInstallation .Assertions .AssertEventualCurlError (
125
+ s .testInstallation .AssertionsT ( s . T ()) .AssertEventualCurlError (
127
126
s .ctx ,
128
127
kubectl.PodExecOptions {
129
128
Name : "curl" ,
Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ func CreateTestInstallationForCluster(
102
102
WithClusterContext (clusterContext ).
103
103
WithGlooGatewayContext (glooGatewayContext ),
104
104
105
+ AssertionsT : func (t * testing.T ) * assertions.Provider {
106
+ return assertions .NewProvider (t ).
107
+ WithClusterContext (clusterContext ).
108
+ WithGlooGatewayContext (glooGatewayContext )
109
+ },
110
+
105
111
// GeneratedFiles contains the unique location where files generated during the execution
106
112
// of tests against this installation will be stored
107
113
// By creating a unique location, per TestInstallation and per Cluster.Name we guarantee isolation
@@ -133,8 +139,12 @@ type TestInstallation struct {
133
139
Actions * actions.Provider
134
140
135
141
// Assertions is the entity that creates assertions that can be executed by the Operator
142
+ // DEPRECATED: Use AssertionsT instead (which is scoped to a specific test and not the root suite)
136
143
Assertions * assertions.Provider
137
144
145
+ // AssertionsT creates an assertion provider that is scoped to the provided test
146
+ AssertionsT func (* testing.T ) * assertions.Provider
147
+
138
148
// GeneratedFiles is the collection of directories and files that this test installation _may_ create
139
149
GeneratedFiles GeneratedFiles
140
150
You can’t perform that action at this time.
0 commit comments