forked from toolshed/abra
		
	test: moar chaos stability 😌 [ci skip]
This commit is contained in:
		@ -50,6 +50,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
@ -62,6 +65,9 @@ teardown(){
 | 
			
		||||
  run $ABRA app check "$TEST_APP_DOMAIN" --chaos
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -53,6 +53,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
@ -66,6 +69,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'baz'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,9 @@ teardown(){
 | 
			
		||||
  _rm_remote "/etc/*.txt"
 | 
			
		||||
 | 
			
		||||
  _rm "$BATS_TMPDIR/mydir"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "validate app argument" {
 | 
			
		||||
@ -34,6 +37,42 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "bail if unstaged changes and no --chaos" {
 | 
			
		||||
  _mkdir "$BATS_TMPDIR/mydir"
 | 
			
		||||
  _mkfile "$BATS_TMPDIR/mydir/myfile.txt" "foo"
 | 
			
		||||
 | 
			
		||||
  run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app cp "$TEST_APP_DOMAIN" "$BATS_TMPDIR/mydir" app:/etc
 | 
			
		||||
  assert_failure
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "do not bail if unstaged changes and --chaos" {
 | 
			
		||||
  _mkdir "$BATS_TMPDIR/mydir"
 | 
			
		||||
  _mkfile "$BATS_TMPDIR/mydir/myfile.txt" "foo"
 | 
			
		||||
 | 
			
		||||
  run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app cp "$TEST_APP_DOMAIN" "$BATS_TMPDIR/mydir" app:/etc --chaos
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "error if missing src/dest arguments" {
 | 
			
		||||
  run $ABRA app cp "$TEST_APP_DOMAIN"
 | 
			
		||||
  assert_failure
 | 
			
		||||
 | 
			
		||||
@ -46,6 +46,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
@ -62,6 +65,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app deploy "$TEST_APP_DOMAIN" \
 | 
			
		||||
    --chaos --no-input --no-converge-checks
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,9 @@ teardown(){
 | 
			
		||||
  _reset_recipe
 | 
			
		||||
  _reset_app
 | 
			
		||||
  _undeploy_app
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "validate app argument" {
 | 
			
		||||
@ -41,6 +44,16 @@ teardown(){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "show env version despite --chaos" {
 | 
			
		||||
  run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app env "$TEST_APP_DOMAIN"
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -46,6 +46,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app labels "$TEST_APP_DOMAIN" --no-input
 | 
			
		||||
  assert_failure
 | 
			
		||||
}
 | 
			
		||||
@ -59,6 +62,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app labels "$TEST_APP_DOMAIN" --chaos
 | 
			
		||||
  assert_success
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -94,6 +94,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app new "$TEST_RECIPE" \
 | 
			
		||||
    --no-input \
 | 
			
		||||
    --server "$TEST_SERVER" \
 | 
			
		||||
@ -114,6 +117,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA app new "$TEST_RECIPE" \
 | 
			
		||||
    --no-input \
 | 
			
		||||
    --chaos \
 | 
			
		||||
 | 
			
		||||
@ -55,6 +55,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
@ -70,6 +73,9 @@ teardown(){
 | 
			
		||||
  run $ABRA app ps --chaos "$TEST_APP_DOMAIN"
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -131,6 +131,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
@ -271,6 +274,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
@ -319,6 +325,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,9 @@ setup(){
 | 
			
		||||
  run $ABRA catalogue generate gitea --chaos
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/catalogue/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/catalogue/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -60,3 +60,7 @@ _get_current_hash() {
 | 
			
		||||
_get_n_hash() {
 | 
			
		||||
  echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" show -s --format="%H" "HEAD~$1")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_git_status() {
 | 
			
		||||
  echo $(git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status --porcelain)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -28,8 +28,6 @@ teardown(){
 | 
			
		||||
 | 
			
		||||
# bats test_tags=slow
 | 
			
		||||
@test "install release candidate from script" {
 | 
			
		||||
  skip "current RC is brokenly specified in the installer script"
 | 
			
		||||
 | 
			
		||||
  run bash -c 'curl https://install.abra.coopcloud.tech | bash -s -- --rc'
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -41,6 +41,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA recipe lint "$TEST_RECIPE"
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
@ -58,6 +61,9 @@ teardown(){
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_output --partial 'foo'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run $ABRA recipe lint "$TEST_RECIPE" --chaos
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -40,6 +40,9 @@ teardown(){
 | 
			
		||||
  run $ABRA recipe sync "$TEST_RECIPE" --no-input --patch
 | 
			
		||||
  assert_success
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_success
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
 | 
			
		||||
@ -54,6 +54,9 @@ teardown(){
 | 
			
		||||
  assert_failure
 | 
			
		||||
  assert_output --partial 'locally unstaged changes'
 | 
			
		||||
 | 
			
		||||
  assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_equal "$(_git_status)" "?? foo"
 | 
			
		||||
 | 
			
		||||
  run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
  assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user