Giter Site home page Giter Site logo

commander-cli / commander Goto Github PK

View Code? Open in Web Editor NEW
222.0 222.0 18.0 10.05 MB

Test your command line interfaces on windows, linux and osx and nodes viá ssh and docker

License: MIT License

Makefile 3.52% Go 92.44% Shell 3.03% Dockerfile 1.01%
cli cmd command-line golang linux osx sh shell terminal testing windows

commander's People

Contributors

brayflex avatar dependabot[bot] avatar dylanhitt avatar glesica avatar simonbaeumer avatar svenfinke avatar taigrr avatar testwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

commander's Issues

distribute tests via ssh

It would be nice if I could define a test which will be executed on a different host via ssh.

Better filters

--filter="should execute command"
--filter="command*" # With wild card pattern

--filter-node="ssh-host"
--filter-node="ssh*"

Maybe with regex support?

Better diffs

It would be nice to print better diffs between the expected and actual result

Add sleep time to retries

I want to add a sleep or interval if a test fails with retries.

I.e.

tests:
    echo hello:
        config:
            retries: 4
            interval: 10s

Running `commander add --file tests/commander.yaml my-command` removes test validation from commander.yaml

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Did you perform a cursory search?

Description

When using the automatic adding of tests, manually added tests validation is removed.

Steps to Reproduce

  1. run commander add --file tests/commander.yaml ./setup-update-tag.sh
  2. check what has changed in the file (e.g. diff --git a/tests/commander.yaml b/tests/commander.yaml)

Expected behavior: commander add should just add new tests, not modify existing ones (resorting the file may be fine)

Actual behavior: It restructures the file and drops test cases. Basically removing most manually made edits.

diff --git a/tests/commander.yaml b/tests/commander.yaml
index 3156fb7..15b5d6c 100755
--- a/tests/commander.yaml
+++ b/tests/commander.yaml
@@ -1,33 +1,18 @@
 tests:
-  setup with existing .env:
-    command: ./setup.sh
+  ./setup-update-tag.sh:
     exit-code: 1
-    stdout: |-
-      Creating individual env files for containers (if they do not exist already)
-      .env already exists with initial configuration
-      If you want to change the configuration, please edit .env directly
+    stdout: Please install reg in order to run this script.
   ./version.sh:
     exit-code: 0
   ./version.sh core:
     exit-code: 0
-    stdout:
-      not-contains:
-        - core-
-        - Debian
-        - amd64
-        - tar.gz
   ./version.sh webapp:
     exit-code: 0
-    stdout:
-      not-contains:
-        - webapp-
-        - Debian
-        - amd64
-        - tar.gz
   ./version.sh zpush:
     exit-code: 0
-    stdout:
-      not-contains:
-        - Debian
-        - amd64
-        - tar.gz
+  setup with existing .env:
+    exit-code: 1
+    stdout: |-
+      Creating individual env files for containers (if they do not exist already)
+      .env already exists with initial configuration
+      If you want to change the configuration, please edit .env directly

Specifications

  • Version: 1.12.0
  • Platform: Ubuntu 16.04
  • Subsystem:

You can get the version information from executing commander --version.

Expose healthcheck

It would be nice to have a command which exposes commander as a healthcheck

Add os for tests

Add a field which defines on which os a test can be executed, i.e.:

tests:
    echo hello:
        os:
        - darwin
        - linux

or maybe this is even better:

config:
    os: linux # Define default os
tests:
     print hello:
         cmd:
             osx: echo hello osx
             windows: echo hello windows
             linux: echo hello linux

Help Needed: Understanding PATH and the commander runner shell

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Did you perform a cursory search?

Related:
#80
#94

Description

Our CLI app makes calls to the shell for other apps, namely docker. During the install step for our cli, it uses docker to pull and configure some containers. If I run install from the shell, it works. If I run install from commander test it fails saying that docker is not found. I had expected config: env: PATH_FROM_SHELL: ${PATH} to fix this, but there is something more going on that I don't understand.

How does each runner use a shell?
Is is an untestable scenario in commander to test a cli application that uses an OS process to call another cli application?

Steps to Reproduce

  1. Install binary from this build
  2. Make sure docker is installed and running.
  3. Run this test:
tests:
  titan install:
    exit-code: 0
    stdout:
      contains:
        - Titan cli successfully installed, happy data versioning :)
config:
  env:
    PATH_FROM_SHELL: ${PATH}
  timeout: 600s

Expected behavior:
install should finish and exit process with 0

Actual behavior:
Test fails with Docker not found

Specifications

  • Version: Commander version v1.2.1
  • Platform: MacOS

Release deployment

  • #6
  • install.sh script which can be fetched via curl
  • travis deployment for github releases on tag

Define dependencies

It would be nice to define dependencies on tests. This is necessary especially if I want to test kubernetes resouces.

It should also be possible to activate an interactive mode for debugging purposes.

Example:

it should deploy:
  command: ...

it should be available:
  command: ...
  depends: it should deploy

Need help getting windows server 2019 working

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Did you perform a cursory search?

Description

Following the instructions in the README to setup a testing environment with github actions and running commander does not have any output. I've tried a few variations of invoking commander, but all with the same results. The file will download, I can see it with ls, but running /commander --version has no output. I have tried adding it to the path (can confirm it's in the path), but running commander --version has the same results.

Steps to Reproduce

Add a github action with the following config:
https://github.com/mcred/titan/blob/feature/e2e/.github/workflows/test.yml

Inspect output:
https://github.com/mcred/titan/commit/ee26a202ea5218314315bbb387705e97161abc17/checks?check_suite_id=268546125

Expected behavior:
Commander version v1.2.1

Actual behavior: [What actually happened]
No output, failure or exceptions.

Specifications

  • Version: v1.2.1 commander-windows-amd64
  • Platform: Windows Server 2019

Add documentation

  • Windows installation
  • Different matchers for Stdout and Stderr
  • Timeout / Env / Dir variables
  • Add more examples

Commander -v missing version number

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Did you perform a cursory search?

Description

The version option output does not contain version numbers.

Steps to Reproduce

  1. Install using go command according to https://github.com/SimonBaeumer/commander#installation :

     go get github.com/SimonBaeumer/commander/cmd/commander
    
  2. On terminal, run:

     commander -v
    

Expected behavior:

Output:

Commander version 0.3.0

Actual behavior:

Output:

Commander version

Specifications

  • Version: Commander 0.3.0 (As found in commit 3fa13b0, 2019-10)
  • Platform: Debian GNU/Linux 9.11 (stretch)
  • Subsystem: Perhaps go version? go1.7.4 linux/amd6

You can get the version information from executing commander --version.

No. Whether commander -v or commander --version, version number is still missing.

Option to not discard environment of current shell?

Prerequisites

  • Can you reproduce the problem in safe mode?
    • I could not find any indication how to enable safe mode in this repository (only mentioned in the issue template)
  • Are you running the latest version?
$ commander -v
Commander version v1.1.0
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

Description

When running programs that are configurable through environment variables (for example inside of a container) running them through commander fails, since previously set variables are not present.

Steps to Reproduce

  1. run
$ commander add --stdout --no-file env
tests:
  env:
    exit-code: 0
    stdout: PWD=/home/user/current-dir

  1. run env directly in the shell
  2. notice that none of the env vars (except for PWD) are listed by commander

Expected behavior: commander has access to the environment of the shell it is executed in.

Actual behavior: no environment is preserved.

Specifications

  • Version: v1.1.0
  • Platform: Ubuntu 16.04 as host, Debian 9 in container
  • Subsystem:

You can get the version information from executing commander --version.

Improve err output for stdout and stderr

At the moment it will only be displayed which root attribute failed the test, i.e.:

Starting test file test.yml...

✗ echo hello

Results

✗ echo hello, on property 'Stdout'
--- Got
+++ Expected
@@ -1 +1 @@
-hello
+fail


Duration: 0.003s
Count: 1, Failed: 1

It is not possible to see in the results which attribute of Stdout failed.

implement add command

It should be possible to create tests by giving the command and automatically create the expectations

$ ./commander add echo hello world
echo hello world:
    stdout:
        exactly: hello-world
    exit-code: 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.