forked from toolshed/abra
		
	fix: integration tests
This commit is contained in:
		| @ -3,6 +3,7 @@ package app | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"strings" | ||||||
|  |  | ||||||
| 	"coopcloud.tech/abra/cli/internal" | 	"coopcloud.tech/abra/cli/internal" | ||||||
| 	"coopcloud.tech/abra/pkg/app" | 	"coopcloud.tech/abra/pkg/app" | ||||||
| @ -275,6 +276,9 @@ func getDeployVersion(cliArgs []string, deployMeta stack.DeployMeta, app app.App | |||||||
|  |  | ||||||
| 	// Check if the recipe has a version in the .env file | 	// Check if the recipe has a version in the .env file | ||||||
| 	if app.Recipe.EnvVersion != "" && !internal.IgnoreEnvVersion { | 	if app.Recipe.EnvVersion != "" && !internal.IgnoreEnvVersion { | ||||||
|  | 		if strings.HasSuffix(app.Recipe.EnvVersionRaw, "+U") { | ||||||
|  | 			return "", fmt.Errorf("version: can not redeploy chaos version %s", app.Recipe.EnvVersionRaw) | ||||||
|  | 		} | ||||||
| 		log.Debugf("version: taking version from .env file: %s", app.Recipe.EnvVersion) | 		log.Debugf("version: taking version from .env file: %s", app.Recipe.EnvVersion) | ||||||
| 		return app.Recipe.EnvVersion, nil | 		return app.Recipe.EnvVersion, nil | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -242,7 +242,7 @@ func validateDowngradeVersionArg( | |||||||
| ) error { | ) error { | ||||||
| 	parsedDeployedVersion, err := tagcmp.Parse(deployMeta.Version) | 	parsedDeployedVersion, err := tagcmp.Parse(deployMeta.Version) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return fmt.Errorf("'%s' is not a known version for %s", deployMeta.Version, app.Recipe.Name) | 		return fmt.Errorf("current deployment '%s' is not a known version for %s", deployMeta.Version, app.Recipe.Name) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	parsedSpecificVersion, err := tagcmp.Parse(specificVersion) | 	parsedSpecificVersion, err := tagcmp.Parse(specificVersion) | ||||||
|  | |||||||
| @ -154,7 +154,7 @@ teardown(){ | |||||||
|   assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
|  |  | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" \ |   run $ABRA app deploy "$TEST_APP_DOMAIN" \ | ||||||
|     --no-input --no-converge-checks --force |     --no-input --no-converge-checks --force --debug | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --regexp 'can not redeploy chaos version .*' + "${headHash:0:8}+U" |   assert_output --regexp 'can not redeploy chaos version .*' + "${headHash:0:8}+U" | ||||||
| } | } | ||||||
| @ -249,7 +249,7 @@ teardown(){ | |||||||
|     --no-input --no-converge-checks --force |     --no-input --no-converge-checks --force | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   assert_output --partial 'CHAOS DEPLOY OVERVIEW' |   assert_output --partial 'REDEPLOY OVERVIEW' | ||||||
|   assert_output --partial "CURRENT DEPLOYMENT    ${headHash:0:8}" |   assert_output --partial "CURRENT DEPLOYMENT    ${headHash:0:8}" | ||||||
|   assert_output --partial "ENV VERSION           ${headHash:0:8}" |   assert_output --partial "ENV VERSION           ${headHash:0:8}" | ||||||
|   assert_output --partial "NEW DEPLOYMENT        ${headHash:0:8}" |   assert_output --partial "NEW DEPLOYMENT        ${headHash:0:8}" | ||||||
|  | |||||||
| @ -164,8 +164,7 @@ teardown(){ | |||||||
|  |  | ||||||
|   run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks |   run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks | ||||||
|   assert_failure |   assert_failure | ||||||
|   assert_output --partial "0.1.1+1.20.2" |   assert_output --partial 'current deployment' + "${tagHash:0:8}" + 'is not a known version' | ||||||
|   assert_output --partial "${tagHash:0:8}" + 'is not a known version' |  | ||||||
| } | } | ||||||
|  |  | ||||||
| # bats test_tags=slow | # bats test_tags=slow | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user