Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upgrade check input #1628

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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