commit | ab37addc4aa18c2d2fc68e64816371c5e7ed415d | [log] [tgz] |
---|---|---|
author | Vincent Hou <shou@us.ibm.com> | Mon Apr 24 13:55:31 2017 -0400 |
committer | Vincent <shou@us.ibm.com> | Tue Apr 25 17:05:19 2017 -0400 |
tree | 6b06af7169fc724e490ed5e455d615811576bf36 | |
parent | 1dbe55d767fd19cdb13fb9a7df8f1f531d4922ad [diff] |
Add the test cases to Go CLI This PR rewrites all the tests regarding the behavior of "Wsk CLI usage", "Wsk invalid argument handling" and "Wsk params and annotations" in go language.
wsk
The OpenWhisk Command Line Interface (OpenWhisk CLI) is a unified tool that provides a consistent interface to interact with OpenWhisk services. With this tool to download and configure, you are able to manage OpenWhisk services from the command line and automate them through scripts.
The OpenWhisk CLI is available on the release page: click here to download. We currently have binaries available for Linux, Mac OS and windows under amd64 architecture. You can download the binary, which fits your local environment.
You can also choose to build the binary locally based on the source code. First, install the prerequisites to download and build OpenWhisk CLI: installing Git.
Then, download the source code via the Git command:
$ git clone https://github.com/openwhisk/openwhisk-cli.git
OpenWhisk CLI(wsk
) is produced in a Docker container during the build process which is copied from the Docker container to the local file system in the following directory: bin. This binary will be platform specific, it will only run on the operating system, and CPU architecture that matches the build machine.
The binary can be built by Go build command. Make sure that you have Go installed: installing Go.
After that, open an terminal, go to the directory of OpenWhisk CLI home directory, and build the binary via the following command:
$ go build -o wsk
If you would like to build the binary for a specific operating system, you may add the arguments GOOS and GOARCH into the Go build command. Since it is only applicable under amd64 architecture, you have to set GOARCH to amd64. GOOS can be set to “linux” “darwin” or “windows”.
For example, run the following command to build the binary for Linux:
$ GOOS=linux GOARCH=amd64 go build -o wsk
If it is executed successfully, you can find your binary wsk
directly under OpenWhisk CLI home directory.
This is the second choice for you to build the binary. Make sure that you have Docker and gradle on your machine: installing Docker and installing Gradle for your local machine.
After that, open an terminal, go to the directory of OpenWhisk CLI home directory, and build the binary via the following command under Linux or Mac:
$ ./gradlew distDocker
or run the following command for Windows:
$ ./gradlew.bat distDocker
Finally, you can find the binary wsk
or wsk.exe
in the bin folder under the OpenWhisk CLI home directory.
When you have the binary, you can copy the binary to any folder, and add folder into the system PATH in order to run the OpenWhisk CLI command. To get the CLI command help, execute the following command:
$ wsk --help
To get CLI command debug information, include the -d, or --debug flag when executing this command.