Skip to content

Commit

Permalink
addons: Add add-on update test to state tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
paladin-devops committed Aug 11, 2023
1 parent 79a1954 commit 7acf45b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions pkg/serverstate/statetest/test_add_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ My favorite add-on README.
CreatedBy: "[email protected]",
}

t.Run("Create, get, and delete Add-on", func(t *testing.T) {
t.Run("Create, get, update, and delete Add-on", func(t *testing.T) {
// Create an add-on definition
addOnDefinition, err := s.AddOnDefinitionPut(ctx, testAddOnDefinition)
require.NoError(err)
Expand Down Expand Up @@ -218,17 +218,31 @@ My favorite add-on README.
require.Equal(testAddOn.TerraformNocodeModule.Source, actualAddOn.TerraformNocodeModule.Source)
require.Equal(testAddOn.TerraformNocodeModule.Version, actualAddOn.TerraformNocodeModule.Version)

updatedAddOnName := "your updated friendly neighborhood add-on"
updatedAddOn, err := s.AddOnUpdate(ctx,
&pb.AddOn{
Name: updatedAddOnName,
},
&pb.Ref_AddOn{
Identifier: &pb.Ref_AddOn_Name{
Name: testAddOn.Name,
},
},
)
require.NoError(err)
require.NotNil(updatedAddOn)

err = s.AddOnDelete(ctx, &pb.Ref_AddOn{
Identifier: &pb.Ref_AddOn_Name{
Name: testAddOn.Name,
Name: updatedAddOnName,
},
})
require.NoError(err)

// Verify Add-On is deleted
actualAddOn, err = s.AddOnGet(ctx, &pb.Ref_AddOn{
Identifier: &pb.Ref_AddOn_Name{
Name: testAddOn.Name,
Name: updatedAddOnName,
},
})
// expecting a not found error
Expand Down

0 comments on commit 7acf45b

Please sign in to comment.