From 7acf45bad45db1d1842950026e1612aba6142f15 Mon Sep 17 00:00:00 2001 From: Joseph Rajewski <83741749+paladin-devops@users.noreply.github.com> Date: Fri, 11 Aug 2023 13:52:40 -0400 Subject: [PATCH] addons: Add add-on update test to state tests. --- pkg/serverstate/statetest/test_add_on.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pkg/serverstate/statetest/test_add_on.go b/pkg/serverstate/statetest/test_add_on.go index 354e3f10560..e8c6d235b7a 100644 --- a/pkg/serverstate/statetest/test_add_on.go +++ b/pkg/serverstate/statetest/test_add_on.go @@ -190,7 +190,7 @@ My favorite add-on README. CreatedBy: "foo@bar.com", } - 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) @@ -218,9 +218,23 @@ 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) @@ -228,7 +242,7 @@ My favorite add-on README. // 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