Files
docker-docs/test/integration/cli/create-rm.bats
Olivier Gambier 5fbfbe1ff7 Rehauled build system and integration testing
- USE_CONTAINER allow to seamlessly run targets inside or outside containers
- all build calls have been harmonized, honoring the same env variables
- contributing doc has been streamlined according to that
- kill the distinction between remote and local docker builds
- got rid of some of the byzantine calls in various asorted scripts
- support for static build, debug builds, verbose

Signed-off-by: Olivier Gambier <olivier@docker.com>
2015-09-18 15:47:00 -07:00

99 lines
3.0 KiB
Bash

#!/usr/bin/env bats
load ${BASE_TEST_DIR}/helpers.bash
@test "bogus: non-existent driver fails 'machine create -d bogus bogus'" {
run machine create -d bogus bogus
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Driver bogus not found" ]]
}
@test "none: create with no name fails 'machine create -d none " "'" {
run machine create -d none
last=$((${#lines[@]} - 1))
[ "$status" -eq 1 ]
[[ ${lines[$last]} == "You must specify a machine name" ]]
}
@test "none: create with invalid name fails 'machine create -d none --url none ∞'" {
run machine create -d none --url none ∞
last=$((${#lines[@]} - 2))
[ "$status" -eq 1 ]
[[ ${lines[$last]} == "Error creating machine: Invalid hostname specified" ]]
}
@test "none: create with invalid name fails 'machine create -d none --url none -'" {
run machine create -d none --url none -
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Error creating machine: Invalid hostname specified" ]]
}
@test "none: create with invalid name fails 'machine create -d none --url none .'" {
run machine create -d none --url none .
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Error creating machine: Invalid hostname specified" ]]
}
@test "none: create with invalid name fails 'machine create -d none --url none ..'" {
run machine create -d none --url none ..
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Error creating machine: Invalid hostname specified" ]]
}
@test "none: create with weird but valid name succeeds 'machine create -d none --url none a'" {
run machine create -d none --url none a
[ "$status" -eq 0 ]
}
# @test "none: name is case insensitive 'machine create -d none --url none A'" {
# run machine create -d none --url none A
# [ "$status" -eq 1 ]
# [[ ${lines[0]} == "Error creating machine: Machine A already exists" ]]
# }
@test "none: extraneous argument is ignored in name 'machine create -d none --url none a foo'" {
run machine create -d none a foo
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Error creating machine: Machine a already exists" ]]
}
@test "none: create with weird but valid name succeeds 'machine create -d none --url none 0'" {
run machine create -d none --url none 0
[ "$status" -eq 0 ]
}
@test "none: rm with no name fails 'machine rm'" {
run machine rm
last=$(expr ${#lines[@]} - 1)
[ "$status" -eq 1 ]
[[ ${lines[$last]} == "You must specify a machine name" ]]
}
@test "none: rm non existent machine fails 'machine rm ∞'" {
run machine rm ∞
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Error removing machine ∞: Error: Host does not exist: ∞" ]]
}
@test "none: rm is succesful 'machine rm 0'" {
run machine rm 0
[ "$status" -eq 0 ]
}
# Should be replaced by the test below
@test "none: rm is succesful 'machine rm a'" {
run machine rm a
[ "$status" -eq 0 ]
}
# @test "none: rm is case insensitive 'machine rm A'" {
# run machine rm A
# [ "$status" -eq 0 ]
# }
@test "none: rm non existent machine fails 'machine rm ∞'" {
run machine rm ∞
[ "$status" -eq 1 ]
[[ ${lines[0]} == "Error removing machine ∞: Error: Host does not exist: ∞" ]]
}