77 client2 "github.com/acorn-io/runtime/integration/client"
88 "github.com/acorn-io/runtime/integration/helper"
99 apiv1 "github.com/acorn-io/runtime/pkg/apis/api.acorn.io/v1"
10- "github.com/acorn-io/runtime/pkg/client"
10+ rclient "github.com/acorn-io/runtime/pkg/client"
1111 kclient "github.com/acorn-io/runtime/pkg/k8sclient"
1212 "github.com/acorn-io/runtime/pkg/publicname"
1313 "github.com/stretchr/testify/assert"
@@ -26,7 +26,7 @@ func TestJobList(t *testing.T) {
2626 kclient := helper .MustReturn (kclient .Default )
2727 project := helper .TempProject (t , kclient )
2828
29- c , err := client .New (restConfig , "" , project .Name )
29+ c , err := rclient .New (restConfig , "" , project .Name )
3030 require .NoError (t , err )
3131
3232 imageID := client2 .NewImageWithJobs (t , project .Name )
@@ -58,7 +58,7 @@ func TestJobGet(t *testing.T) {
5858 kclient := helper .MustReturn (kclient .Default )
5959 project := helper .TempProject (t , kclient )
6060
61- c , err := client .New (restConfig , "" , project .Name )
61+ c , err := rclient .New (restConfig , "" , project .Name )
6262 require .NoError (t , err )
6363
6464 imageID := client2 .NewImageWithJobs (t , project .Name )
@@ -106,29 +106,27 @@ func TestJobRestart(t *testing.T) {
106106 lclient , err := kclient .New (restConfig )
107107 require .NoError (t , err )
108108
109- kclient := helper .MustReturn (kclient .Default )
110- project := helper .TempProject (t , kclient )
109+ client := helper .MustReturn (kclient .Default )
110+ project := helper .TempProject (t , client )
111111
112- c , err := client .New (restConfig , "" , project .Name )
112+ c , err := rclient .New (restConfig , "" , project .Name )
113113 require .NoError (t , err )
114114
115- imageID := client2 .NewImageWithJobs (t , project .Name )
116- app , err := c .AppRun (ctx , imageID , nil )
115+ app , err := c .AppRun (ctx , client2 .NewImageWithJobs (t , project .Name ), nil )
117116 require .NoError (t , err )
118117
119118 // Wait for the Job to initially complete
120119 var firstCompletion * metav1.Time
121- helper .WaitForObject (t , lclient .Watch , & apiv1.AppList {}, app , func (app * apiv1.App ) bool {
120+ app = helper .WaitForObject (t , lclient .Watch , & apiv1.AppList {}, app , func (app * apiv1.App ) bool {
122121 firstCompletion = app .Status .AppStatus .Jobs ["job" ].CompletionTime
123- return app .Status .Namespace != "" && app . Status . AppStatus .Jobs ["job" ].CompletionTime != nil
122+ return app .Status .AppStatus .Jobs ["job" ].CompletionTime != nil
124123 })
125124
126125 require .NoError (t , c .JobRestart (ctx , publicname .ForChild (app , "job" )))
127126
128127 // Wait for the Job to complete again by checking for a difference in the completion time
129- helper .WaitForObject (t , lclient .Watch , & apiv1.AppList {}, app , func (app * apiv1.App ) bool {
130- secondCompletion := app .Status .AppStatus .Jobs ["job" ].CompletionTime
131- return app .Status .Namespace != "" && ! firstCompletion .Equal (secondCompletion )
128+ app = helper .WaitForObject (t , lclient .Watch , & apiv1.AppList {}, app , func (app * apiv1.App ) bool {
129+ return ! firstCompletion .Equal (app .Status .AppStatus .Jobs ["job" ].CompletionTime )
132130 })
133131
134132 require .NoError (t , c .JobRestart (ctx , publicname .ForChild (app , "cronjob" )))
0 commit comments