Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc automation:Command Reference: odo create namespace #6703

Merged
merged 7 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions docs/website/docs/command-reference/create-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ odo create namespace <name>
<details>
<summary>Example</summary>

```shell
$ odo create namespace mynamespace
✓ Namespace "mynamespace" is ready for use
✓ New namespace created and now using namespace: mynamespace
```
import CreateNamespace from './docs-mdx/create-namespace/create_namespace.mdx';

<CreateNamespace />

</details>


Expand All @@ -31,11 +30,10 @@ odo create project <name>
<details>
<summary>Example</summary>

```shell
$ odo create project myproject
✓ Project "myproject" is ready for use
✓ New project created and now using project: myproject
```
import CreateProject from './docs-mdx/create-namespace/create_project.mdx';

<CreateProject />

</details>


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```console
$ odo create namespace odo-dev
✓ Namespace "odo-dev" is ready for use
✓ New namespace created and now using namespace: odo-dev
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```console
$ odo create project odo-dev
✓ Project "odo-dev" is ready for use
✓ New project created and now using project: odo-dev
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package docautomation

import (
"fmt"
"path/filepath"
"strings"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/tests/helper"
)

var _ = Describe("doc command reference odo create namespace", func() {
var commonVar helper.CommonVar
var commonPath = filepath.Join("command-reference", "docs-mdx", "create-namespace")
var outputStringFormat = "```console\n$ odo %s\n%s```\n"

BeforeEach(func() {
commonVar = helper.CommonBeforeEach()
helper.Chdir(commonVar.Context)
Expect(helper.VerifyFileExists(".odo/env/env.yaml")).To(BeFalse())
})

AfterEach(func() {
helper.CommonAfterEach(commonVar)
})

Context("To create a namespace resource", func() {

AfterEach(func() {
commonVar.CliRunner.DeleteNamespaceProject("odo-dev", true)
})

It("Creates a namespace resource for a kubernetes cluster", func() {
args := []string{"create", "namespace", "odo-dev"}
out := helper.Cmd("odo", args...).ShouldPass().Out()
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
file := "create_namespace.mdx"
want := helper.GetMDXContent(filepath.Join(commonPath, file))
diff := cmp.Diff(want, got)
Expect(diff).To(BeEmpty(), file)
})

It("Creates a project resource for a kubernetes cluster", func() {
args := []string{"create", "project", "odo-dev"}
out := helper.Cmd("odo", args...).ShouldPass().Out()
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
file := "create_project.mdx"
want := helper.GetMDXContent(filepath.Join(commonPath, file))
diff := cmp.Diff(want, got)
Expect(diff).To(BeEmpty(), file)
})
})

})