mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
add json output test for preference view (#3806)
* add json output test for preference view * failing intg test * add a before each to use a fresh preference
This commit is contained in:
@@ -76,6 +76,14 @@ var _ = Describe("odo preference and config command tests", func() {
|
||||
})
|
||||
|
||||
Context("When configuring global config values", func() {
|
||||
JustBeforeEach(func() {
|
||||
context = helper.CreateNewContext()
|
||||
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "preference.yaml"))
|
||||
})
|
||||
JustAfterEach(func() {
|
||||
helper.DeleteDir(context)
|
||||
os.Unsetenv("GLOBALODOCONFIG")
|
||||
})
|
||||
It("should successfully updated", func() {
|
||||
helper.CmdShouldPass("odo", "preference", "set", "updatenotification", "false")
|
||||
helper.CmdShouldPass("odo", "preference", "set", "timeout", "5")
|
||||
@@ -103,6 +111,15 @@ var _ = Describe("odo preference and config command tests", func() {
|
||||
helper.CmdShouldFail("odo", "preference", "set", "-f", "experimental", "invalid-value")
|
||||
helper.CmdShouldFail("odo", "preference", "set", "-f", "updatenotification", "invalid-value")
|
||||
})
|
||||
|
||||
It("should show json output", func() {
|
||||
prefJSONOutput, err := helper.Unindented(helper.CmdShouldPass("odo", "preference", "view", "-o", "json"))
|
||||
Expect(err).Should(BeNil())
|
||||
expected, err := helper.Unindented(`{"kind":"PreferenceList","apiVersion":"odo.dev/v1alpha1","items":[{"Name":"UpdateNotification","Value":null,"Default":true,"Type":"bool","Description":"Flag to control if an update notification is shown or not (Default: true)"},{"Name":"NamePrefix","Value":null,"Default":"","Type":"string","Description":"Use this value to set a default name prefix (Default: current directory name)"},{"Name":"Timeout","Value":null,"Default":1,"Type":"int","Description":"Timeout (in seconds) for OpenShift server connection check (Default: 1)"},{"Name":"BuildTimeout","Value":null,"Default":300,"Type":"int","Description":"BuildTimeout (in seconds) for waiting for a build of the git component to complete (Default: 300)"},{"Name":"PushTimeout","Value":null,"Default":240,"Type":"int","Description":"PushTimeout (in seconds) for waiting for a Pod to come up (Default: 240)"},{"Name":"Experimental","Value":null,"Default":false,"Type":"bool","Description":"Set this value to true to expose features in development/experimental mode"},{"Name":"PushTarget","Value":null,"Default":"kube","Type":"string","Description":"Set this value to 'kube' or 'docker' to tell odo where to push applications to. (Default: kube)"}]}`)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(prefJSONOutput).Should(MatchJSON(expected))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Context("when creating odo local config in the same config dir", func() {
|
||||
|
||||
Reference in New Issue
Block a user