Skip to content

Commit

Permalink
Fix upgrade check input (#1628)
Browse files Browse the repository at this point in the history
* remove input checks

* remove input checks
  • Loading branch information
sunkickr authored and kushalmalani committed Apr 22, 2024
1 parent f29562d commit ef52643
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
10 changes: 0 additions & 10 deletions cmd/airflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
30 changes: 0 additions & 30 deletions cmd/airflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 3 additions & 5 deletions cmd/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ef52643

Please sign in to comment.