Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Proposal: PoC for Bats integration tests #443

Merged
merged 1 commit into from
Mar 4, 2015
Merged
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
15 changes: 15 additions & 0 deletions test/integration/manage-non-available-node.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bats

load vars

@test "managing non-available node should be timed out" {

#
# timeout does not accept a bash function, so hard-coded path is required
#
run timeout 15s $GOBIN/swarm manage -H 127.0.0.1:2375 nodes://8.8.8.8:2375

[ "$status" -ne 0 ]
[[ ${lines[0]} =~ "Listening for HTTP" ]]
[[ ${lines[1]} =~ "ConnectEx tcp: i/o timeout" ]]
}
5 changes: 5 additions & 0 deletions test/integration/vars.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

function swarm() {
$GOBIN/swarm $@
}
10 changes: 10 additions & 0 deletions test/integration/version-and-gitcommit.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bats

load vars

@test "version string should contain a proper number with git commit" {
run swarm -v

[ "$status" -eq 0 ]
[[ ${lines[0]} =~ version\ [0-9]+\.[0-9]+\.[0-9]+\ \([0-9a-f]{7}\)$ ]]
}