Skip to content

Commit 898426d

Browse files
authored
Merge 3539355 into 08c3904
2 parents 08c3904 + 3539355 commit 898426d

File tree

4 files changed

+82
-10
lines changed

4 files changed

+82
-10
lines changed

docs/website/docs/command-reference/create-namespace.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ odo create namespace <name>
1414
<details>
1515
<summary>Example</summary>
1616

17-
```shell
18-
$ odo create namespace mynamespace
19-
✓ Namespace "mynamespace" is ready for use
20-
✓ New namespace created and now using namespace: mynamespace
21-
```
17+
import CreateNamespace from './docs-mdx/create-namespace/create_namespace.mdx';
18+
19+
<CreateNamespace />
20+
2221
</details>
2322

2423

@@ -31,11 +30,10 @@ odo create project <name>
3130
<details>
3231
<summary>Example</summary>
3332

34-
```shell
35-
$ odo create project myproject
36-
✓ Project "myproject" is ready for use
37-
✓ New project created and now using project: myproject
38-
```
33+
import CreateProject from './docs-mdx/create-namespace/create_project.mdx';
34+
35+
<CreateProject />
36+
3937
</details>
4038

4139

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
```console
2+
$ odo create namespace odo-dev
3+
✓ Namespace "odo-dev" is ready for use
4+
✓ New namespace created and now using namespace: odo-dev
5+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
```console
2+
$ odo create project odo-dev
3+
✓ Project "odo-dev" is ready for use
4+
✓ New project created and now using project: odo-dev
5+
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package docautomation
2+
3+
import (
4+
"fmt"
5+
"path/filepath"
6+
"strings"
7+
8+
"github.com/google/go-cmp/cmp"
9+
. "github.com/onsi/ginkgo/v2"
10+
. "github.com/onsi/gomega"
11+
"github.com/redhat-developer/odo/tests/helper"
12+
)
13+
14+
var _ = Describe("doc command reference odo create namespace", func() {
15+
var commonVar helper.CommonVar
16+
var commonPath = filepath.Join("command-reference", "docs-mdx", "create-namespace")
17+
var outputStringFormat = "```console\n$ odo %s\n%s```\n"
18+
19+
BeforeEach(func() {
20+
commonVar = helper.CommonBeforeEach()
21+
helper.Chdir(commonVar.Context)
22+
Expect(helper.VerifyFileExists(".odo/env/env.yaml")).To(BeFalse())
23+
})
24+
25+
AfterEach(func() {
26+
helper.CommonAfterEach(commonVar)
27+
})
28+
29+
Context("To create a namespace resource", func() {
30+
31+
AfterEach(func() {
32+
commonVar.CliRunner.DeleteNamespaceProject("mynamespace", true)
33+
})
34+
35+
It("Creates a namespace for a kubernetes cluster", func() {
36+
args := []string{"create", "namespace", "mynamespace"}
37+
out := helper.Cmd("odo", args...).ShouldPass().Out()
38+
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
39+
file := "create_namespace.mdx"
40+
want := helper.GetMDXContent(filepath.Join(commonPath, file))
41+
diff := cmp.Diff(want, got)
42+
Expect(diff).To(BeEmpty(), file)
43+
})
44+
45+
})
46+
47+
Context("To create a project resource", func() {
48+
49+
BeforeEach(func() {
50+
commonVar.CliRunner.DeleteNamespaceProject("myproject", true)
51+
})
52+
53+
It("Creates a project resource for a kubernetes cluster", func() {
54+
args := []string{"create", "project", "myproject"}
55+
out := helper.Cmd("odo", args...).ShouldPass().Out()
56+
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
57+
file := "create_project.mdx"
58+
want := helper.GetMDXContent(filepath.Join(commonPath, file))
59+
diff := cmp.Diff(want, got)
60+
Expect(diff).To(BeEmpty(), file)
61+
})
62+
})
63+
64+
})

0 commit comments

Comments
 (0)