@@ -21,7 +21,11 @@ import (
2121type Availability struct {
2222 newConnectionTestName string
2323 reusedConnectionTestName string
24- jobType * platformidentification.JobType
24+
25+ // store the rest config so we can
26+ // get the JobType at the end of the run
27+ // which will include any upgrade versions
28+ adminRESTConfig * rest.Config
2529
2630 newConnectionDisruptionSampler * backenddisruption.BackendSampler
2731 reusedConnectionDisruptionSampler * backenddisruption.BackendSampler
@@ -43,11 +47,7 @@ func (w *Availability) StartCollection(ctx context.Context, adminRESTConfig *res
4347 return fmt .Errorf ("unable to start collection because instance is nil" )
4448 }
4549
46- var err error
47- w .jobType , err = platformidentification .GetJobType (ctx , adminRESTConfig )
48- if err != nil {
49- return err
50- }
50+ w .adminRESTConfig = adminRESTConfig
5151
5252 if err := w .newConnectionDisruptionSampler .StartEndpointMonitoring (ctx , recorder , nil ); err != nil {
5353 return err
@@ -140,8 +140,8 @@ func createDisruptionJunit(testName string, allowedDisruption *time.Duration, di
140140 }
141141}
142142
143- func (w * Availability ) junitForNewConnections (ctx context.Context , finalIntervals monitorapi.Intervals ) (* junitapi.JUnitTestCase , error ) {
144- newConnectionAllowed , newConnectionDisruptionDetails , err := historicalAllowedDisruption (ctx , w .newConnectionDisruptionSampler , w . jobType )
143+ func (w * Availability ) junitForNewConnections (ctx context.Context , finalIntervals monitorapi.Intervals , jobType * platformidentification. JobType ) (* junitapi.JUnitTestCase , error ) {
144+ newConnectionAllowed , newConnectionDisruptionDetails , err := historicalAllowedDisruption (ctx , w .newConnectionDisruptionSampler , jobType )
145145 if err != nil {
146146 return nil , fmt .Errorf ("unable to get new allowed disruption: %w" , err )
147147 }
@@ -157,8 +157,8 @@ func (w *Availability) junitForNewConnections(ctx context.Context, finalInterval
157157 nil
158158}
159159
160- func (w * Availability ) junitForReusedConnections (ctx context.Context , finalIntervals monitorapi.Intervals ) (* junitapi.JUnitTestCase , error ) {
161- reusedConnectionAllowed , reusedConnectionDisruptionDetails , err := historicalAllowedDisruption (ctx , w .reusedConnectionDisruptionSampler , w . jobType )
160+ func (w * Availability ) junitForReusedConnections (ctx context.Context , finalIntervals monitorapi.Intervals , jobType * platformidentification. JobType ) (* junitapi.JUnitTestCase , error ) {
161+ reusedConnectionAllowed , reusedConnectionDisruptionDetails , err := historicalAllowedDisruption (ctx , w .reusedConnectionDisruptionSampler , jobType )
162162 if err != nil {
163163 return nil , fmt .Errorf ("unable to get reused allowed disruption: %w" , err )
164164 }
@@ -183,12 +183,18 @@ func (w *Availability) EvaluateTestsFromConstructedIntervals(ctx context.Context
183183 return nil , fmt .Errorf ("unable to evaluate tests because instance is nil" )
184184 }
185185
186- newConnectionJunit , err := w .junitForNewConnections (ctx , finalIntervals )
186+ var err error
187+ jobType , err := platformidentification .GetJobType (ctx , w .adminRESTConfig )
188+ if err != nil {
189+ return nil , err
190+ }
191+
192+ newConnectionJunit , err := w .junitForNewConnections (ctx , finalIntervals , jobType )
187193 if err != nil {
188194 return nil , err
189195 }
190196
191- reusedConnectionJunit , err := w .junitForReusedConnections (ctx , finalIntervals )
197+ reusedConnectionJunit , err := w .junitForReusedConnections (ctx , finalIntervals , jobType )
192198 if err != nil {
193199 return nil , err
194200 }
0 commit comments