@@ -10,81 +10,83 @@ import (
1010 "github.com/deis/deis/tests/utils"
1111)
1212
13+ var (
14+ appsCreateCmd = "apps:create {{.AppName}}"
15+ appsListCmd = "apps:list"
16+ appsRunCmd = "apps:run echo hello"
17+ appsOpenCmd = "apps:open --app={{.AppName}}"
18+ appsLogsCmd = "apps:logs --app={{.AppName}}"
19+ appsInfoCmd = "apps:info --app={{.AppName}}"
20+ appsDestroyCmd = "apps:destroy --app={{.AppName}} --confirm={{.AppName}}"
21+ )
22+
1323func appsSetup (t * testing.T ) * itutils.DeisTestConfig {
1424 cfg := itutils .GetGlobalConfig ()
1525 cfg .AppName = "appssample"
16- cmd := itutils .GetCommand ("auth" , "login" )
17- itutils .Execute (t , cmd , cfg , false , "" )
18- cmd = itutils .GetCommand ("git" , "clone" )
19- itutils .Execute (t , cmd , cfg , false , "" )
26+ itutils .Execute (t , authLoginCmd , cfg , false , "" )
27+ itutils .Execute (t , gitCloneCmd , cfg , false , "" )
2028 return cfg
2129}
2230
2331func appsCreateTest (t * testing.T , params * itutils.DeisTestConfig ) {
24- cmd := itutils . GetCommand ( "apps" , "create" )
32+ cmd := appsCreateCmd
2533 if err := utils .Chdir (params .ExampleApp ); err != nil {
26- t .Fatalf ( "Failed: \n %v" , err )
34+ t .Fatal ( err )
2735 }
2836 itutils .Execute (t , cmd , params , false , "" )
2937 itutils .Execute (t , cmd , params , true , "App with this Id already exists" )
30-
3138 if err := utils .Chdir (".." ); err != nil {
32- t .Fatalf ( "Failed: \n %v" , err )
39+ t .Fatal ( err )
3340 }
3441}
3542
3643func appsRunTest (t * testing.T , params * itutils.DeisTestConfig ) {
37- cmd := itutils . GetCommand ( "apps" , "run" )
44+ cmd := appsRunCmd
3845 if err := utils .Chdir (params .ExampleApp ); err != nil {
39- t .Fatalf ( "Failed: \n %v" , err )
46+ t .Fatal ( err )
4047 }
4148 itutils .Execute (t , cmd , params , false , "" )
42-
4349 if err := utils .Chdir (".." ); err != nil {
44- t .Fatalf ( "Failed: \n %v" , err )
50+ t .Fatal ( err )
4551 }
4652 itutils .Execute (t , cmd , params , true , "Not found" )
4753}
4854
4955func appsDestroyTest (t * testing.T , params * itutils.DeisTestConfig ) {
50- cmd := itutils .GetCommand ("apps" , "destroy" )
5156 if err := utils .Chdir (params .ExampleApp ); err != nil {
52- t .Fatalf ( "Failed: \n %v" , err )
57+ t .Fatal ( err )
5358 }
54- itutils .Execute (t , cmd , params , false , "" )
59+ itutils .Execute (t , appsDestroyCmd , params , false , "" )
5560 if err := utils .Chdir (".." ); err != nil {
56- t .Fatalf ( "Failed: \n %v" , err )
61+ t .Fatal ( err )
5762 }
5863 if err := utils .Rmdir (params .ExampleApp ); err != nil {
59- t .Fatalf ( "Failed: \n %v" , err )
64+ t .Fatal ( err )
6065 }
6166}
6267
6368func appsListTest (t * testing.T , params * itutils.DeisTestConfig , notflag bool ) {
64- cmd := itutils .GetCommand ("apps" , "list" )
65- itutils .CheckList (t , params , cmd , params .AppName , notflag )
69+ itutils .CheckList (t , params , appsListCmd , params .AppName , notflag )
6670}
6771
6872func appsLogsTest (t * testing.T , params * itutils.DeisTestConfig ) {
69- cmd := itutils .GetCommand ("apps" , "logs" )
70- cmd1 := itutils .GetCommand ("git" , "push" )
73+ cmd := appsLogsCmd
7174 itutils .Execute (t , cmd , params , true , "204 NO CONTENT" )
7275 if err := utils .Chdir (params .ExampleApp ); err != nil {
73- t .Fatalf ( "Failed: \n %v" , err )
76+ t .Fatal ( err )
7477 }
75- itutils .Execute (t , cmd1 , params , false , "" )
78+ itutils .Execute (t , gitPushCmd , params , false , "" )
7679 // TODO: nginx needs a few seconds to wake up here--fixme!
7780 time .Sleep (5000 * time .Millisecond )
7881 itutils .Curl (t , params )
7982 itutils .Execute (t , cmd , params , false , "" )
8083 if err := utils .Chdir (".." ); err != nil {
81- t .Fatalf ( "Failed: \n %v" , err )
84+ t .Fatal ( err )
8285 }
8386}
8487
8588func appsInfoTest (t * testing.T , params * itutils.DeisTestConfig ) {
86- cmd := itutils .GetCommand ("apps" , "info" )
87- itutils .Execute (t , cmd , params , false , "" )
89+ itutils .Execute (t , appsInfoCmd , params , false , "" )
8890}
8991
9092func appsOpenTest (t * testing.T , params * itutils.DeisTestConfig ) {
0 commit comments