@@ -56,8 +56,6 @@ type Session struct {
5656 Env []string
5757 retainDirs bool
5858 createdProjects []* project.Namespaced
59- // users created during session
60- users []string
6159 T * testing.T
6260 Exe string
6361 SvcExe string
@@ -542,11 +540,6 @@ func (s *Session) Close() error {
542540
543541 s .spawned = []* SpawnedCmd {}
544542
545- if os .Getenv ("PLATFORM_API_TOKEN" ) == "" {
546- s .T .Log ("PLATFORM_API_TOKEN env var not set, not running suite tear down" )
547- return nil
548- }
549-
550543 auth := authentication .New (cfg )
551544
552545 if os .Getenv (constants .APIHostEnvVarName ) == "" {
@@ -560,9 +553,11 @@ func (s *Session) Close() error {
560553 }
561554
562555 err = auth .AuthenticateWithModel (& mono_models.Credentials {
563- Token : os .Getenv ("PLATFORM_API_TOKEN" ),
556+ Username : PersistentUsername ,
557+ Password : PersistentPassword ,
564558 })
565559 if err != nil {
560+ s .T .Errorf ("Could not login: %v" , errs .JoinMessage (err ))
566561 return err
567562 }
568563
@@ -586,14 +581,7 @@ func (s *Session) Close() error {
586581 for _ , proj := range s .createdProjects {
587582 err := model .DeleteProject (proj .Owner , proj .Project , auth )
588583 if err != nil {
589- s .T .Errorf ("Could not delete project %s: %v" , proj .Project , errs .JoinMessage (err ))
590- }
591- }
592-
593- for _ , user := range s .users {
594- err := cleanUser (s .T , user , auth )
595- if err != nil {
596- s .T .Errorf ("Could not delete user %s: %v" , user , errs .JoinMessage (err ))
584+ s .T .Errorf ("Could not delete project %s/%s: %v" , proj .Owner , proj .Project , errs .JoinMessage (err ))
597585 }
598586 }
599587
@@ -799,7 +787,7 @@ func (s *Session) SetupRCFileCustom(subshell subshell.SubShell) {
799787 rcFile , err := subshell .RcFile ()
800788 require .NoError (s .T , err )
801789
802- if fileutils .TargetExists (filepath .Join (s .Dirs .HomeDir , filepath .Base (rcFile ))) {
790+ if fileutils .TargetExists (rcFile ) && fileutils . TargetExists ( filepath .Join (s .Dirs .HomeDir , filepath .Base (rcFile ))) {
803791 err = fileutils .CopyFile (rcFile , filepath .Join (s .Dirs .HomeDir , filepath .Base (rcFile )))
804792 } else {
805793 err = fileutils .Touch (filepath .Join (s .Dirs .HomeDir , filepath .Base (rcFile )))
0 commit comments