forked from toolshed/abra
		
	
		
			
				
	
	
		
			151 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			151 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| setup_file(){
 | |
|   load "$PWD/tests/integration/helpers/common"
 | |
|   _common_setup
 | |
|   _add_server
 | |
|   _new_app
 | |
| }
 | |
| 
 | |
| teardown_file(){
 | |
|   _rm_app
 | |
|   _rm_server
 | |
| }
 | |
| 
 | |
| setup(){
 | |
|   load "$PWD/tests/integration/helpers/common"
 | |
|   _common_setup
 | |
| }
 | |
| 
 | |
| teardown(){
 | |
|   _undeploy_app
 | |
| }
 | |
| 
 | |
| @test "ls validate app argument" {
 | |
|   run $ABRA app volume ls
 | |
|   assert_failure
 | |
| 
 | |
|   run $ABRA app volume ls DOESNTEXIST
 | |
|   assert_failure
 | |
| }
 | |
| 
 | |
| @test "list no volumes" {
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'no volumes created'
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "list volumes" {
 | |
|   _deploy_app
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume'
 | |
| }
 | |
| 
 | |
| @test "rm validate app argument" {
 | |
|   run $ABRA app volume rm
 | |
|   assert_failure
 | |
| 
 | |
|   run $ABRA app volume rm DOESNTEXIST
 | |
|   assert_failure
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "rm error if deployed" {
 | |
|   _deploy_app
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
 | |
|   assert_failure
 | |
|   assert_output --partial 'is still deployed'
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "remove volumes" {
 | |
|   _deploy_app
 | |
|   _undeploy_app
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume'
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
 | |
|   assert_success
 | |
|   assert_output --partial 'volumes removed successfully'
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'no volumes created'
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "remove no volumes" {
 | |
|   _deploy_app
 | |
|   _undeploy_app
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
 | |
|   assert_success
 | |
|   assert_output --partial 'volumes removed successfully'
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
 | |
|   assert_success
 | |
|   assert_output --partial 'no volumes removed'
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "remove single volume" {
 | |
|   _deploy_app
 | |
|   _undeploy_app
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume'
 | |
|   assert_output --partial 'test-volume-two'
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" test-volume-two --force
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume-two removed successfully'
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume'
 | |
|   refute_output --partial 'test-volume-two'
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" --force
 | |
|   assert_success
 | |
|   assert_output --partial 'volumes removed successfully'
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'no volumes created'
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "remove single volume incorrect name" {
 | |
|   _deploy_app
 | |
|   _undeploy_app
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" DOESNTEXIST --force
 | |
|   assert_failure
 | |
|   assert_output --partial 'no volume with name'
 | |
| }
 | |
| 
 | |
| # bats test_tags=slow
 | |
| @test "remove single volume doesn't delete similar name" {
 | |
|   _deploy_app
 | |
|   _undeploy_app
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume-two'
 | |
| 
 | |
|   run $ABRA app volume rm "$TEST_APP_DOMAIN" test-volume --force
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume removed successfully'
 | |
| 
 | |
|   run $ABRA app volume ls "$TEST_APP_DOMAIN"
 | |
|   assert_success
 | |
|   assert_output --partial 'test-volume-two'
 | |
| }
 |