Commit Graph

267 Commits

Author SHA1 Message Date
dr.max 9e29ce893f test(commands): backfills gotest.tools tests for version & completion cmds (#223) 2019-07-09 11:44:55 -07:00
Roland Huß 2ae037f3be refactor(service): Removed io.writer from of KnClient.WaitForService() (#248)
This puts all the console output to the command, where it belongs too.
One could add a ProgressHandler for more fine granular feedback (like suggested in #234) but for now this is not needed.
2019-07-08 11:57:34 -07:00
Roland Huß 98184eafbc refactor(serving): KnClient interface for single point of cluster access (#134)
* fix(serving): Remove hardcoded GVK and look it up from schema

Fixes #133.

* chore(serving): Add test for "WaitForService()"

* refactor(service): Add listRoutes() to client + generic way for list options

* chore(serving): Fixing rebase conflicts
2019-07-08 10:08:34 -07:00
Joan Edwards 0cbc4e1b18 Bulleted components in kn.md (#243) 2019-07-08 03:25:33 -07:00
Navid Shaikh 389a7592bc Adds step to simplify code along with goimports (#239)
(and gofmt if goimports isn't available)

 - Runs goimports on all packages except vendor dir and filter on only *.go files

 - Runs gofmt on all dirs except vendor and filters on *.go files, also writes the results instead of printing diff

 - Fixes typo s/insteat/insead

 - Adds the changes after adding simply code step in hack/build.sh

 - Uses source_dir var specifying the dirs to work on

 - Combines gofmt commands into single command
2019-07-08 03:17:33 -07:00
Joan Edwards 314be82e0a Correct minor grammatical issue (#238) 2019-07-07 23:48:33 -07:00
Joan Edwards ca90232c9a Small grammatical correction for README.md (#237)
* Small grammatical correction for README.md

* Update README.md
2019-07-07 23:41:33 -07:00
Ashleigh Brennan 38a4a6fc18 Added link to OpenShift kubeconfig creation docs (#226) 2019-07-06 00:43:31 -07:00
Navid Shaikh fc9b24c1e5 Add custom comparison for checking multiple substrings (#227)
* Adds custom comparison for checking multiple substrings

 This changeset introduces custom comparison for checking if a target
 string has given multiple substrings, namely `ContainsMultipleSubstrings`.

 Also removes `commands.TestContains` function and replaces all references
 of `commands.TestContains` with `gotest.tools/assert.Check` function and
 uses `ContainsMultipleSubstrings` as comparison function.

* Renames and makes the compare function variadic

 New name: ContainsAll
 New location: pkg/util/compare.go
 Also the function now takes target string as first arg,
 and accepts any number of substrings to check.
 Removed the message arg, the compare function composes the error message.
 For eg:
```
        Actual output: foo-abcd   foo       <unknown>   0 OK / 0     <unknown>   <unknown>
        Missing strings: foo-abcd1, foo1
```

* Adds tests for compare utility ContainsAll

* Update vendor/modules.txt
2019-07-05 10:07:32 -07:00
Roland Huß 2db1195b3f fix(release.sh): Point to proper directory to extract the serving version (#221)
The argument to build_flags.sh must point to the basedirectory where
go.mod is located.

Fixes #212
2019-07-03 01:47:32 -07:00
dr.max 500b7d1371 fixes(issue #111) generically for all command groups (#218)
Explores all sub-commands from root and adds a RunE for all
commands that are groups with child commands and without a RunE.
The added RunE will return the correct errors when the command
is called with empty sub-command or with an unknown sub-command.
It will also print the command help message first.

Added a gotest.tools test for root.go.
2019-07-02 23:50:32 -07:00
Roland Huß d51a3a8d91 fix(serving): Fix logic 'service create --force' and some bogus tests (#216)
* fix(servicing): Fix logic 'service create --force' and some bogus tests

Now a more meaningful error is returned when the user tries to create
a service that already exists. Until know the service is tried
to be created even if the client already knows that it exists.

Also some broken (broken in the sense that the test was nonsense) tests has been fixed.

* chore(serving): Use constant instead of string lateral in test
2019-07-02 12:19:32 -07:00
Navid Shaikh aac0ec265e Adds kn route list command (#202)
- Accepts an argument name for listing particular route
- Enables the machine readable output flags
- Updates docs for kn route command group
- Adds unit tests for route command group and route list
- Adds integration tests for route list in basic workflow test
- Updates tests and getting namespace
- Adds more unit tests for code in pkg/kn/commands/route/list_flags.go
- Adds route list command in smoke tests
- Updates vendor/modules.txt
- Clean up imports
- Addresses review comments
 - replaces knative to Knative
 - uses reflect.DeepEqual for slice comparison
 - removes few code comments
 - removes irrelevant tests modifications from the PR
2019-07-02 11:25:32 -07:00
Navid Shaikh e431ba2d54 Removes pausing between e2e smoke tests (#220)
* Removes pausing between e2e smoke tests

 Removes time.Sleep as by default service create waits for it to
 become ready. Also adds a command to create service in --async mode.

* Checks if service create in async mode is ready

 also describes the async mode service and finally deletes it
2019-07-02 03:31:31 -07:00
Navid Shaikh eb53a6f999 Exchange SERVICE and NAME column in kn revision list output (#219)
* Exchange SERVICE and NAME column in kn revision list output

 Fixes #195

* Uses serving.ServiceLableKey instead of serving.ConfigurationLabelKey
2019-07-01 08:50:19 -07:00
Roland Huß 94009191ae fix(serving): Fixed error message when timeout happens during wait for timeout (#215) 2019-06-30 20:04:18 -07:00
dr.max 43b37a6747 Fixes `limits-memory` and `requests-memory` descriptions (#198)
Erroneously showed ‘CPU’ for ‘memory’ in description strings
2019-06-28 12:04:08 -07:00
Vincent 663d76a413 Add the support to test against specified release of Knative serving (#170) 2019-06-28 11:30:08 -07:00
savitaashture 4cc5c84264 Added changes to support container port information while creating/updating service (#191) 2019-06-28 10:48:08 -07:00
Navid Shaikh 65f1c081ee Add kn revision delete command (#207)
* Adds kn revision delete command

* Adds unit tests for revision delete command

* Adds integration tests for revision delete command

 Added revision delete command tests in new workflow namely
 TestRevisionWorkflow.

* Removes extra line and renames an import alias

* Adds 10 seconds sleep between service create and revision delete

 Also adds check for 'No resources found' while grabbing revision name.

* Clean up imports

* Removes the pause after service create

* Updates testing output strings in unit and e2e

* Updates post goimports on hack and test dirs
2019-06-28 10:21:08 -07:00
Roland Huß a60d273d82 feat(build.sh): Enable goimports + cleanup imports in source files (#186)
* feat(build.sh): Enable goimports for cleanup imports + cleanup imports

Much like 'go fmt' for cleaning up go source, 'goimports' can help
in properly formatting and grouping imports. See https://goinbigdata.com/goimports-vs-gofmt/
for a quick overview.

This commit also cleansup imports on existing files.

* fix(build): Add missing space for output on iterm

* chore(build): Merged gofmt and goimports

And changed order so that formatting and import reordering comes
before compiling and testing
2019-06-28 06:30:08 -07:00
Roland Huß a7d1bc9dc0 feat(service create): Wait for a service to be ready when its created (#156)
* feat(service create): Added --no-wait and --wait-timeout

By default, `kn service create` blocks until the service is either
created or an error occured during service creation.

With the option --no-wait the behaviour can be switched to an
async mode so that that kn returns immediately after the service is
created without waiting for a successful Ready status condition.

The timeout for how long to wait can be configured with --wait-timeout
If a timeout occur, that doesn't mean that the service is not created,
but the wait just returns. The default value is 60 seconds.

In wait mode, print out the service URL as a last line (so that it can be used together with `tail -1`) to extract the service URL after the service is created.

Fixes #54

* chore(service create): Tolerate if obeservedGeneration has not been set yet during startup

* chore(service create): Refactored based on review comments

* Introduced an --async flag (replacing --wait and --no-wait)
* Added proper retry handling on the list watch
* Updated help message

* chore(service wait): Added a new test for sync behaviour
2019-06-28 05:57:06 -07:00
Chi Zhang 483979bba4 Fix the periodic CI flow error in client (#200)
* hack the emitmetrics flag

* update test-infra
2019-06-27 09:53:07 -07:00
Naomi Seyfer d4c2d4ad55 Add rhuss and maximilien to OWNERS to increase approver speed. (#209) 2019-06-26 16:32:05 -07:00
Roland Huß a0eb6118cd fix(build.sh): Cosmetic spacing fix (#199)
* fix(build.sh): Cosmetic spacing fix

Iterm has an issue with rendering multi byte unicode chars. This
commit adds an extra space to certain emojis on iterm only.

This fixes current rendering issues on Linux term because that extra
space was added previously unconditionally.

* fix(build.sh): Avoid uninitialized variable ITERM_PROFILE
2019-06-25 11:13:05 -07:00
dr.max d556df17ac Restores the bash e2e tests as a smoke test (#183) 2019-06-25 10:35:06 -07:00
Kenjiro Nakayama 13ff277095 Set current namespace from kubeconfig by default (#172)
* Set current namespace from kubeconfig by default

Currently kn command does not pick up namespace from kubeconfig but
hardcorded default namespace.

This patch fixes to get namespace from kubeconfig.

Fixes https://github.com/knative/client/issues/7

* Use NamespaceFactory to get current namespace

* Update unit tests

* Add nil check for ClientConfig
2019-06-24 11:23:05 -07:00
Navid Shaikh 9c865a6115 List revisions for a given service (#194)
* Lists revisions for a given service

 Fixes #127

* Adds unit tests for listing revisions of a service

* Adds integration tests for listing revisions of a service

* Updates docs for listing revisions of a service

* Updates vendor/modules.txt
2019-06-20 13:29:00 -07:00
Naomi Seyfer 32ccc334e3 Revert #173 and #139, reinstating having a config file. (#193)
* Revert #173 and #139

* Change default layout to have a hidden kn dir

* Update deps
2019-06-19 18:12:58 -07:00
Roland Huß 8a1d412f52 fix(service update): Print success message after successful update (#169)
* fix(service update): Print success message after successful update

* chore(service update): Improve test, revert unneeded changes
2019-06-17 12:23:45 -07:00
Rohan Kumar c2be52d281 Chore: Fix typos in docs (#178) 2019-06-17 12:08:46 -07:00
Roland Huß 74abba5eb4 feat(build.sh) - Add mandatory license check (#187)
We could decide to make that optional, too, if this is coming into the way.
2019-06-14 15:50:43 -07:00
Navid Shaikh 5d26faa4ff Renames revision 'get' to 'list' (#180)
* Renames revision 'get' to 'list'

 As per title.

* Renames revision get references to revision list in docs
2019-06-13 13:56:51 -07:00
Navid Shaikh d25ea5f1e7 Renames service 'get' to 'list' (#179)
* Renames service 'get' to 'list'

 As per title.

* Renames get references to list in e2e tests

* Replaces get to list in docs
2019-06-13 13:56:43 -07:00
Ali Ok e010ca816d Fix typo in README.md (#181) 2019-06-13 13:42:43 -07:00
dr.max 39d994794b Adds a Golang version of e2e Basic workflow that can execute locally (#121)
1. creates a namespace 'kne2etests' (default name, change with env KN_E2E_NAMESPACE)
2. executes kn commands as per Basic workflow doc in said namespace
3. verifies each command's output
4. deletes the 'kne2etests' namespace
2019-06-11 19:49:43 -07:00
Roland Huß 0d94947366 fix(build.sh): Change from xnotify to fswatch for watching source code (#171)
While working with `build.sh --watch` it turned out the underlying
tool xnotify is not matured enough:

* It doesn't work when IntelliJ IDEA changes a file
* It can't deal with ignoring newly generated temp files (like .swp for vi)

This commit exchanges xnotify with fswatch which is much more matured.
2019-06-10 11:41:44 -07:00
Roland Huß ecc61d59c1 fix(e2e): Use build.sh for compiling (#175)
* fix(e2e): Use build.sh for compiling

Fixes #174.

* Update test/e2e-tests.sh

Co-Authored-By: Adriano Cunha <35786489+adrcunha@users.noreply.github.com>
2019-06-10 11:30:42 -07:00
Kenjiro Nakayama 176cb0ea72 Remove unused value CfgFile (#173)
This patch removes unused `CfgFile` value from codes.
2019-06-10 11:04:43 -07:00
Kenjiro Nakayama 1b471d587f Remove unused `--config` option (#139)
* Remove unused `--config` option

Currently `--config` option in kn command is not used from anywhere.
This patch removes the option from the command.

* update auto gen files

* Update deps by hack/update-deps.sh
2019-06-08 09:03:41 -07:00
Suraj Narwade 5308101a48 Move DEVELOPMENT.md to docs directory (#105)
* it will make easy to access docs from single directory, it will also help in case if we create github pages for the same

* fixed links from README.md

rebased and addressed comments
2019-06-08 08:47:41 -07:00
Roland Huß b885e41974 feat(service create/update): Add support of minScale/maxScale/concurrency-target/concurrency-limit (#157)
Autoscaler concurrency annotations are added to the revision template if
--min-scale / --max-scale / --concurrency-target/--concurrency-limit
are provided to `kn service create` and `kn service update`

Fixes #151
2019-06-08 08:27:40 -07:00
Roland Huß 8a1adf0cb0 feat(build.sh): Add a watch mode for automatic recompilation (#160)
This features uses and requires https://github.com/AgentCosmic/xnotify
and should work on any platform

Use it with

* Watch & compile: build.sh --watch
* Watch, compile, test: build.sh --watch --test
* Watch, compile, test & verbose output: build.sh --watch --test --verbose

(shortcuts -w && -t can be used, too)
2019-06-06 18:10:40 -07:00
Kenjiro Nakayama 01da225f85 Update go.mod and go.sum by test/presubmit-tests.sh (#162)
This changes are updated by `test/presubmit-tests.sh`.
2019-06-06 17:59:40 -07:00
Vincent 5d2a7aa912 Add the support to build container image for kn (#152) 2019-06-06 17:30:40 -07:00
dr.max 0800d7c4d3 Regroups code to use subpackages. Finishes issue #66 (#145)
Creates four subpackages for now:

1. kn/commands - inludes types.go for common
   struct and other common files and misc commands
2. kn/commands/service - all 'kn service *' commands
3. kn/commands/revision - all 'kn revision *' commands
4. kn/core - contains the root.go and other top level
   for code and testing
5. refactors:
   a. split .../commons/human_readable_flags.go into three
   b. modifies the HumanReadableFlags.ToPrinter to get pass
      a function that sets the columns and fields

Had to refactor all tests to avoid cycles.
2019-06-05 16:30:38 -07:00
Roland Huß b6a8fa9213 fix(service update): Only update fields which have been sent by server. (#155)
* fix(service update): Only update fields which have been sent by server.

This reflects the lemonade process step1. Tests have been adapted to
verify this behaviours.

The only situation when we update field coming from the server is for
"kn service update" for envs, image and requests/limits.

All other operation are either create (here, we always have to send the
old fields), or read (get/describe).

Fixes #144.

* chore: typo fix

* refactor(service update/create): Moved from Configuration to RevisionTemplateSpec

In order to proper handling the v1alpha1 -> v1beta1 migration methods has been updated to get rid fo Configuration within the service as this
is completely inlined in v1beta1.

The helper methods have been also updated accordingly.
I think we are good now.
2019-06-03 13:30:35 -07:00
Joyce Liu 43061af74a Update test-infra to the latest version (#154) 2019-05-31 17:41:33 -07:00
Roland Huß 9221429cb0 feat(build.sh): Adding options and running tests (#149)
* feat(build.sh): Adding options and running tests

* Added running unit tests to the script
* Added options to support different development flows (see help message below)
* Allow symlinking to /usr/local/bin so that the script can be called from everywhere

Usage message:

Knative Client Build Script

Usage: hack/build.sh [... options ...]

with the following options:

-f  --fast                    Only build (without formatting, testing, code generation)
-t  --test                    Run tests even when used with --fast
-u  --update                  Update dependencies
-h  --help                    Display this help message
    --verbose                 Verbose script output (set -x)

You can add a symbolic link to this build script into your PATH so that it can be
called from everywhere. E.g.:

ln -s .../hack/build.sh /usr/local/bin/kn_build.sh

Examples:

* Compile, format, tests, docs:       build.sh
* Compile only:                       build.sh --fast
* Compile with tests:                 build.sh -f -t

* doc(build.sh): Added documentation for new build.sh options

* docs(build.sh): Cosmetic fixes

* docs(build.sh): Tiny documentation fix

* chore(build.sh): Another typo fix
2019-05-30 10:18:32 -07:00
Joyce Liu cf41ab2b73 update test-infra in vendor (#148) 2019-05-29 11:46:31 -07:00