From ef526433094e6478e5c5acc990a1dffaeb18b1eb Mon Sep 17 00:00:00 2001 From: David Koenitzer Date: Mon, 22 Apr 2024 16:00:31 -0400 Subject: [PATCH] Fix upgrade check input (#1628) * remove input checks * remove input checks --- cmd/airflow.go | 10 ---------- cmd/airflow_test.go | 30 ------------------------------ cmd/errors.go | 8 +++----- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/cmd/airflow.go b/cmd/airflow.go index 5baea062e..6ae641da2 100644 --- a/cmd/airflow.go +++ b/cmd/airflow.go @@ -579,16 +579,6 @@ func airflowUpgradeTest(cmd *cobra.Command, platformCoreClient astroplatformcore if airflowVersion != "" && runtimeVersion != "" { return errInvalidBothAirflowAndRuntimeVersionsUpgrade } - // error if both custom image and deployment id is used - if deploymentID != "" && customImageName != "" { - return errInvalidBothDeploymentIDandCustomImage - } - if airflowVersion != "" && deploymentID != "" { - return errInvalidBothDeploymentIDandVersion - } - if runtimeVersion != "" && deploymentID != "" { - return errInvalidBothDeploymentIDandVersion - } if runtimeVersion != "" && customImageName != "" { return errInvalidBothCustomImageandVersion } diff --git a/cmd/airflow_test.go b/cmd/airflow_test.go index 22ce7baf0..155f4c780 100644 --- a/cmd/airflow_test.go +++ b/cmd/airflow_test.go @@ -595,36 +595,6 @@ func TestAirflowUpgradeTest(t *testing.T) { assert.ErrorIs(t, err, errInvalidBothAirflowAndRuntimeVersionsUpgrade) }) - t.Run("Both custom image and deployment id used", func(t *testing.T) { - cmd := newAirflowUpgradeTestCmd(nil) - - deploymentID = "something" - customImageName = "something" - - err := airflowUpgradeTest(cmd, nil) - assert.ErrorIs(t, err, errInvalidBothDeploymentIDandCustomImage) - }) - - t.Run("Both airflow version and deployment id used", func(t *testing.T) { - cmd := newAirflowUpgradeTestCmd(nil) - - deploymentID = "something" - airflowVersion = "something" - - err := airflowUpgradeTest(cmd, nil) - assert.ErrorIs(t, err, errInvalidBothDeploymentIDandVersion) - }) - - t.Run("Both runtime version and deployment id used", func(t *testing.T) { - cmd := newAirflowUpgradeTestCmd(nil) - - deploymentID = "something" - runtimeVersion = "something" - - err := airflowUpgradeTest(cmd, nil) - assert.ErrorIs(t, err, errInvalidBothDeploymentIDandVersion) - }) - t.Run("Both runtime version and custom image used", func(t *testing.T) { cmd := newAirflowUpgradeTestCmd(nil) diff --git a/cmd/errors.go b/cmd/errors.go index 2d8d83800..9f08184de 100644 --- a/cmd/errors.go +++ b/cmd/errors.go @@ -5,11 +5,9 @@ import ( ) var ( - errInvalidBothAirflowAndRuntimeVersions = errors.New("You provided both a runtime version and an Airflow version. You have to provide only one of these to initialize your project.") //nolint - errInvalidBothAirflowAndRuntimeVersionsUpgrade = errors.New("You provided both a runtime version and an Airflow version. You have to provide only one of these to upgrade.") //nolint - errInvalidBothDeploymentIDandCustomImage = errors.New("You provided both a Deployment ID and a Custom image. You have to provide only one of these to upgrade.") //nolint - errInvalidBothDeploymentIDandVersion = errors.New("You provided both a Deployment ID and a version. You have to provide only one of these to upgrade.") //nolint - errInvalidBothCustomImageandVersion = errors.New("You provided both a Custom image and a version. You have to provide only one of these to upgrade.") //nolint + errInvalidBothAirflowAndRuntimeVersions = errors.New("you provided both a runtime version and an Airflow version. You have to provide only one of these to initialize your project") //nolint + errInvalidBothAirflowAndRuntimeVersionsUpgrade = errors.New("you provided both a runtime version and an Airflow version. You have to provide only one of these to upgrade") //nolint + errInvalidBothCustomImageandVersion = errors.New("you provided both a Custom image and a version. You have to provide only one of these to upgrade") //nolint errConfigProjectName = errors.New("project name is invalid") errProjectNameSpaces = errors.New("this project name is invalid, a project name cannot contain spaces. Try using '-' instead")