File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Expand file tree Collapse file tree 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() {
108108}
109109
110110func (s * k8sServerTlsTestingSuite ) assertEventualResponse (hostHeaderValue string , matcher * matchers.HttpResponse ) {
111-
112111 // Check curl works against expected response
113- s .testInstallation .Assertions .AssertEventualCurlResponse (
112+ s .testInstallation .AssertionsT ( s . T ()) .AssertEventualCurlResponse (
114113 s .ctx ,
115114 kubectl.PodExecOptions {
116115 Name : "curl" ,
@@ -123,7 +122,7 @@ func (s *k8sServerTlsTestingSuite) assertEventualResponse(hostHeaderValue string
123122
124123func (s * k8sServerTlsTestingSuite ) assertEventualError (hostHeaderValue string , code int ) {
125124 // Check curl works against expected response
126- s .testInstallation .Assertions .AssertEventualCurlError (
125+ s .testInstallation .AssertionsT ( s . T ()) .AssertEventualCurlError (
127126 s .ctx ,
128127 kubectl.PodExecOptions {
129128 Name : "curl" ,
Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ func CreateTestInstallationForCluster(
102102 WithClusterContext (clusterContext ).
103103 WithGlooGatewayContext (glooGatewayContext ),
104104
105+ AssertionsT : func (t * testing.T ) * assertions.Provider {
106+ return assertions .NewProvider (t ).
107+ WithClusterContext (clusterContext ).
108+ WithGlooGatewayContext (glooGatewayContext )
109+ },
110+
105111 // GeneratedFiles contains the unique location where files generated during the execution
106112 // of tests against this installation will be stored
107113 // By creating a unique location, per TestInstallation and per Cluster.Name we guarantee isolation
@@ -133,8 +139,12 @@ type TestInstallation struct {
133139 Actions * actions.Provider
134140
135141 // 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)
136143 Assertions * assertions.Provider
137144
145+ // AssertionsT creates an assertion provider that is scoped to the provided test
146+ AssertionsT func (* testing.T ) * assertions.Provider
147+
138148 // GeneratedFiles is the collection of directories and files that this test installation _may_ create
139149 GeneratedFiles GeneratedFiles
140150
You can’t perform that action at this time.
0 commit comments