@@ -61,13 +61,40 @@ var _ = Describe("odo dev command tests", func() {
61
61
})
62
62
})
63
63
64
- When ("a component is bootstrapped and pushed " , func () {
64
+ When ("a component is bootstrapped" , func () {
65
65
BeforeEach (func () {
66
66
helper .CopyExample (filepath .Join ("source" , "devfiles" , "nodejs" , "project" ), commonVar .Context )
67
67
helper .Cmd ("odo" , "init" , "--name" , cmpName , "--devfile-path" , helper .GetExamplePath ("source" , "devfiles" , "nodejs" , "devfile.yaml" )).ShouldPass ()
68
68
Expect (helper .VerifyFileExists (".odo/env/env.yaml" )).To (BeFalse ())
69
69
})
70
70
71
+ It ("should fail to run odo dev when not connected to any cluster" , Label (helper .LabelNoCluster ), func () {
72
+ errOut := helper .Cmd ("odo" , "dev" ).ShouldFail ().Err ()
73
+ Expect (errOut ).To (ContainSubstring ("unable to access the cluster" ))
74
+ })
75
+ It ("should fail to run odo dev when podman is nil" , Label (helper .LabelPodman ), func () {
76
+ errOut := helper .Cmd ("odo" , "dev" , "--platform" , "podman" ).WithEnv ("PODMAN_CMD=echo" ).ShouldFail ().Err ()
77
+ Expect (errOut ).To (ContainSubstring ("unable to access podman" ))
78
+ })
79
+ When ("using a default namespace" , func () {
80
+ BeforeEach (func () {
81
+ commonVar .CliRunner .SetProject ("default" )
82
+ })
83
+ AfterEach (func () {
84
+ commonVar .CliRunner .SetProject (commonVar .Project )
85
+ })
86
+ It ("should print warning about default namespace when running odo dev" , func () {
87
+ namespace := "project"
88
+ if helper .IsKubernetesCluster () {
89
+ namespace = "namespace"
90
+ }
91
+ err := helper .RunDevMode (helper.DevSessionOpts {}, func (session * gexec.Session , outContents []byte , errContents []byte , ports map [string ]string ) {
92
+ Expect (string (errContents )).To (ContainSubstring (fmt .Sprintf ("You are using \" default\" %[1]s, odo may not work as expected in the default %[1]s." , namespace )))
93
+ })
94
+ Expect (err ).ToNot (HaveOccurred ())
95
+ })
96
+ })
97
+
71
98
It ("should add annotation to use ImageStreams" , func () {
72
99
// #6376
73
100
err := helper .RunDevMode (helper.DevSessionOpts {}, func (session * gexec.Session , outContents , errContents []byte , ports map [string ]string ) {
@@ -1807,11 +1834,12 @@ CMD ["npm", "start"]
1807
1834
})
1808
1835
1809
1836
It ("should not build images when odo dev is run" , func () {
1810
- _ , sessionOut , _ , err := helper .DevModeShouldFail (
1837
+ _ , sessionOut , _ , err := helper .WaitForDevModeToContain (
1811
1838
helper.DevSessionOpts {
1812
1839
EnvVars : env ,
1813
1840
},
1814
- "failed to retrieve " + url )
1841
+ "failed to retrieve " + url ,
1842
+ false )
1815
1843
Expect (err ).To (BeNil ())
1816
1844
Expect (sessionOut ).NotTo (ContainSubstring ("build -t quay.io/unknown-account/myimage -f " ))
1817
1845
Expect (sessionOut ).NotTo (ContainSubstring ("push quay.io/unknown-account/myimage" ))
@@ -2658,48 +2686,6 @@ CMD ["npm", "start"]
2658
2686
}))
2659
2687
}
2660
2688
2661
- Context ("using Kubernetes cluster" , func () {
2662
- BeforeEach (func () {
2663
- if os .Getenv ("KUBERNETES" ) != "true" {
2664
- Skip ("This is a Kubernetes specific scenario, skipping" )
2665
- }
2666
- })
2667
-
2668
- It ("should run odo dev successfully on default namespace" , func () {
2669
- helper .CopyExample (filepath .Join ("source" , "nodejs" ), commonVar .Context )
2670
- helper .Cmd ("odo" , "init" , "--name" , cmpName , "--devfile-path" , helper .GetExamplePath ("source" , "devfiles" , "nodejs" , "devfile.yaml" )).ShouldPass ()
2671
- helper .CopyExample (filepath .Join ("source" , "devfiles" , "nodejs" , "project" ), commonVar .Context )
2672
-
2673
- session , _ , errContents , _ , err := helper .StartDevMode (helper.DevSessionOpts {})
2674
- Expect (err ).ToNot (HaveOccurred ())
2675
- defer func () {
2676
- session .Stop ()
2677
- session .WaitEnd ()
2678
- }()
2679
- helper .DontMatchAllInOutput (string (errContents ), []string {"odo may not work as expected in the default project" })
2680
- })
2681
- })
2682
-
2683
- /* TODO(feloy) Issue #5591
2684
- Context("using OpenShift cluster", func() {
2685
- BeforeEach(func() {
2686
- if os.Getenv("KUBERNETES") == "true" {
2687
- Skip("This is a OpenShift specific scenario, skipping")
2688
- }
2689
- })
2690
- It("should run odo dev successfully on default namespace", func() {
2691
- helper.CopyExample(filepath.Join("source", "nodejs"), commonVar.Context)
2692
- helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile.yaml")).ShouldPass()
2693
- helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
2694
-
2695
- session, _, errContents, err := helper.StartDevMode(helper.DevSessionOpts{})
2696
- Expect(err).ToNot(HaveOccurred())
2697
- defer session.Stop()
2698
- helper.MatchAllInOutput(string(errContents), []string{"odo may not work as expected in the default project"})
2699
- })
2700
- })
2701
- */
2702
-
2703
2689
// Test reused and adapted from the now-removed `cmd_devfile_delete_test.go`.
2704
2690
// cf. https://github.com/redhat-developer/odo/blob/24fd02673d25eb4c7bb166ec3369554a8e64b59c/tests/integration/devfile/cmd_devfile_delete_test.go#L172-L238
2705
2691
When ("a component with endpoints is bootstrapped and pushed" , func () {
0 commit comments