-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,44 @@ | ||
#!/usr/bin/env bats | ||
|
||
CONTAINER_ID=$(docker ps | grep iofog-agent | awk '{print $1}') | ||
PREFIX_CMD="docker exec ${CONTAINER_ID} | ||
PREFIX_CMD="docker exec ${CONTAINER_ID}" | ||
|
||
@test "addition within container" { | ||
result="$(${PREFIX_CMD} echo 2+2)" | ||
[ "${result} -eq 4 ] | ||
} | ||
@test "iofog-agent status" { | ||
result="$(${PREFIX_CMD} iofog-agent status)" | ||
[[ ${result} -eq 4 ]] | ||
} | ||
|
||
@test "iofog-agent network_interface" { | ||
result="$(${PREFIX_CMD} nano /etc/iofog-agent/config.xml | grep '<network_interface>dynamic</network_interface>' )" | ||
[[ "${result} ?? 'dynamic'" ]] | ||
} | ||
|
||
@test "iofog-agent version" { | ||
result="$(${PREFIX_CMD} iofog-agent version)" | ||
[[ "${result} ?? '1.0.'" ]] | ||
} | ||
|
||
@test "iofog-agent info" { | ||
result="$(${PREFIX_CMD} iofog-agent info )" | ||
[[ "${result} ?? 'Iofog UUID'" ]] | ||
} | ||
|
||
@test "iofog-agent provision BAD" { | ||
result="$(${PREFIX_CMD} iofog-agent provision 'asd')" | ||
[[ "${result} ?? 'Invalid Provisioning Key'" ]] | ||
} | ||
|
||
@test "iofog-agent config INVALID RAM" { | ||
result="$(${PREFIX_CMD} iofog-agent config -m 50)" | ||
[[ "${result} ?? 'Memory limit range'" ]] | ||
} | ||
|
||
@test "iofog-agent config RAM string" { | ||
result="$(${PREFIX_CMD} iofog-agent config -m test)" | ||
[[ "${result} ?? 'invalid value'" ]] | ||
} | ||
|
||
@test "iofog-agent config VALID RAM" { | ||
result="$(${PREFIX_CMD} iofog-agent config -m 80)" | ||
[[ "${result} ?? 'New Value'" ]] | ||
} |