Skip to content

Commit

Permalink
Introduction of astro deploy --image-name=image_name --remote --runti…
Browse files Browse the repository at this point in the history
…me-version=rt_version
  • Loading branch information
rujhan-arora-astronomer committed Dec 16, 2024
1 parent 021a142 commit cc9dae8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions software/deploy/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,21 +1040,21 @@ func (s *Suite) TestUpdateDeploymentImage() {

s.Run("When runtimeVersion is empty", func() {
houstonMock := new(houston_mocks.ClientInterface)
returnedDeploymentId, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, "", imageName)
returnedDeploymentID, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, "", imageName)
s.ErrorIs(err, ErrRuntimeVersionNotPassedForRemoteImage)
houstonMock.AssertExpectations(s.T())
s.Equal(returnedDeploymentId, "")
s.Equal(returnedDeploymentID, "")
})

s.Run("When getDeploymentIDForCurrentCommandVar gives an error", func() {
getDeploymentIDForCurrentCommandVar = func(houstonClient houston.ClientInterface, wsID, deploymentID string, prompt bool) (string, []houston.Deployment, error) {
return deploymentID, nil, errDeploymentNotFound
}
houstonMock := new(houston_mocks.ClientInterface)
returnedDeploymentId, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
returnedDeploymentID, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
s.ErrorIs(err, errDeploymentNotFound)
houstonMock.AssertExpectations(s.T())
s.Equal(returnedDeploymentId, "")
s.Equal(returnedDeploymentID, "")
})

s.Run("When an error occurs in the GetDeployment api call", func() {
Expand All @@ -1064,10 +1064,10 @@ func (s *Suite) TestUpdateDeploymentImage() {
houstonMock := new(houston_mocks.ClientInterface)
houstonMock.On("GetDeployment", mock.Anything).Return(nil, errMockHouston).Once()

returnedDeploymentId, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
returnedDeploymentID, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
s.ErrorContains(err, "failed to get deployment info: some houston error")
houstonMock.AssertExpectations(s.T())
s.Equal(returnedDeploymentId, "")
s.Equal(returnedDeploymentID, "")
})

s.Run("Houston API call throws error", func() {
Expand All @@ -1080,10 +1080,10 @@ func (s *Suite) TestUpdateDeploymentImage() {
}
houstonMock.On("GetDeployment", mock.Anything).Return(deployment, nil).Once()
houstonMock.On("UpdateDeploymentImage", mock.Anything).Return(nil, errMockHouston).Once()
returnedDeploymentId, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
returnedDeploymentID, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
s.ErrorContains(err, "some houston error")
houstonMock.AssertExpectations(s.T())
s.Equal(returnedDeploymentId, deploymentID)
s.Equal(returnedDeploymentID, deploymentID)
})

s.Run("Successful API call", func() {
Expand All @@ -1101,9 +1101,9 @@ func (s *Suite) TestUpdateDeploymentImage() {
}
houstonMock.On("GetDeployment", mock.Anything).Return(deployment, nil).Once()
houstonMock.On("UpdateDeploymentImage", mock.Anything).Return(updateDeploymentImageResp, nil).Once()
returnedDeploymentId, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
returnedDeploymentID, err := UpdateDeploymentImage(houstonMock, deploymentID, wsID, runtimeVersion, imageName)
houstonMock.AssertExpectations(s.T())
s.ErrorIs(err, nil)
s.Equal(returnedDeploymentId, deploymentID)
s.Equal(returnedDeploymentID, deploymentID)
})
}

0 comments on commit cc9dae8

Please sign in to comment.