From 1e6a6e6174b69380b7f8901c5e40d05adb69f6ca Mon Sep 17 00:00:00 2001 From: decentral1se Date: Wed, 27 Sep 2023 09:19:57 +0200 Subject: [PATCH] fix: app logs retrieves recipe --- cli/app/logs.go | 5 +++++ tests/integration/app_logs.bats | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/cli/app/logs.go b/cli/app/logs.go index 5c60f324..b1566f3f 100644 --- a/cli/app/logs.go +++ b/cli/app/logs.go @@ -11,6 +11,7 @@ import ( "coopcloud.tech/abra/pkg/autocomplete" "coopcloud.tech/abra/pkg/client" "coopcloud.tech/abra/pkg/config" + "coopcloud.tech/abra/pkg/recipe" "coopcloud.tech/abra/pkg/service" "coopcloud.tech/abra/pkg/upstream/stack" "github.com/docker/docker/api/types" @@ -86,6 +87,10 @@ var appLogsCommand = cli.Command{ app := internal.ValidateApp(c) stackName := app.StackName() + if err := recipe.EnsureExists(app.Recipe); err != nil { + logrus.Fatal(err) + } + cl, err := client.New(app.Server) if err != nil { logrus.Fatal(err) diff --git a/tests/integration/app_logs.bats b/tests/integration/app_logs.bats index 4b5e3f50..8760fdcc 100644 --- a/tests/integration/app_logs.bats +++ b/tests/integration/app_logs.bats @@ -32,3 +32,15 @@ setup(){ assert_failure assert_output --partial 'is not deployed' } + +@test "retrieve recipe if missing" { + run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" + assert_success + assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" + + run $ABRA app logs "$TEST_APP_DOMAIN" + assert_failure + assert_output --partial 'is not deployed' + + assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE" +}