Skip to content

Commit

Permalink
addons: Update add-on tests for new fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
paladin-devops committed Aug 9, 2023
1 parent 3c43c19 commit 6fd19a3
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions pkg/serverstate/statetest/test_add_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ My favorite add-on README.
})

testAddOn := &pb.AddOn{
Name: pn + "-" + addOnDefinitionName,
Name: pn + "-" + addOnDefinitionName + "-1",
Project: &pb.Ref_Project{
Project: pn,
},
Expand All @@ -179,9 +179,15 @@ My favorite add-on README.
Name: testUpdatedTestAddOnDefinition.Name,
},
},
TfWorkspaceName: pn + addOnDefinitionName,
ReadmeMarkdown: readme, // this does NOT test any rendering
Tags: tags,
ShortSummary: "My super short summary.",
LongSummary: "My super long summary.",
TerraformNocodeModule: &pb.TerraformNocodeModule{
Source: "my/test/module",
Version: "0.0.2",
},
ReadmeMarkdown: readme, // this does NOT test any rendering
Tags: tags,
CreatedBy: "[email protected]",
}

t.Run("Create, get, and delete Add-on", func(t *testing.T) {
Expand All @@ -202,12 +208,15 @@ My favorite add-on README.
})
require.NoError(err)
require.Equal(testAddOn.Name, actualAddOn.Name)
require.Equal(testAddOn.Name, actualAddOn.Name)
require.Equal(testAddOn.Tags, actualAddOn.Tags)
require.Equal(testAddOn.Project, actualAddOn.Project)
require.Equal(testAddOn.Definition, actualAddOn.Definition)
require.Equal(testAddOn.ReadmeMarkdown, actualAddOn.ReadmeMarkdown)
require.Equal(testAddOn.TfWorkspaceName, actualAddOn.TfWorkspaceName)
require.Equal(testAddOn.ShortSummary, actualAddOn.ShortSummary)
require.Equal(testAddOn.LongSummary, actualAddOn.LongSummary)
require.NotNil(actualAddOn.TerraformNocodeModule)
require.Equal(testAddOn.TerraformNocodeModule.Source, actualAddOn.TerraformNocodeModule.Source)
require.Equal(testAddOn.TerraformNocodeModule.Version, actualAddOn.TerraformNocodeModule.Version)

err = s.AddOnDelete(ctx, &pb.Ref_AddOn{
Identifier: &pb.Ref_AddOn_Name{
Expand Down Expand Up @@ -236,7 +245,6 @@ My favorite add-on README.
require.Equal(testAddOn.Project, addOn.Project)
require.Equal(testAddOn.Definition, addOn.Definition)
require.Equal(testAddOn.ReadmeMarkdown, addOn.ReadmeMarkdown)
require.Equal(testAddOn.TfWorkspaceName, addOn.TfWorkspaceName)

// Delete Add-On definition
err = s.AddOnDefinitionDelete(ctx, &pb.Ref_AddOnDefinition{
Expand All @@ -257,7 +265,6 @@ My favorite add-on README.
require.Equal(testAddOn.Project, actualAddOn.Project)
require.Equal(testAddOn.Definition, actualAddOn.Definition)
require.Equal(testAddOn.ReadmeMarkdown, actualAddOn.ReadmeMarkdown)
require.Equal(testAddOn.TfWorkspaceName, actualAddOn.TfWorkspaceName)
})
}

Expand Down

0 comments on commit 6fd19a3

Please sign in to comment.