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

Added some initial tests #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ If you are contributing to ops, debugging, or want to try out bleeding edge feat

This means your global ops script will point directly to the repo and you can make live changes.

# run tests with bats
# https://github.com/sstephenson/bats
bats test

## License

MIT License
Expand Down
26 changes: 26 additions & 0 deletions test/main.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bats


@test "valid syntax" {
bash -n ops.sh
}

@test "valid version" {
[[ "$(bash ops.sh version)" =~ "ops version " ]]
}

@test "valid help" {
[[ "$(bash ops.sh help)" =~ "Usage: ops <command>" ]]
}

@test "services successfully started" {
bash ops.sh start

[[ -z "$(bash ops.sh ps | grep Exit)" ]]
}

@test "services successfully stopped" {
bash ops.sh stop

[[ -z "$(bash ops.sh ps | grep Up)" ]]
}