Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjackson committed Mar 16, 2024
1 parent e8088c8 commit 851845c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func testSetupConfig(t *testing.T) (*Config, []types.Resource) {
Processed: "bcd",
}

mod1, _ := typs.CreateResource(types.TypeModule, "module1")
mod1, _ := typs.CreateResource(resources.TypeModule, "module1")
mod1.AddDependency("resource.network.cloud")

mod1.Metadata().Checksum = types.Checksum{
Expand Down Expand Up @@ -96,7 +96,7 @@ func testSetupConfig(t *testing.T) (*Config, []types.Resource) {
Processed: "jkl",
}

out2, _ := typs.CreateResource(types.TypeOutput, "out")
out2, _ := typs.CreateResource(resources.TypeOutput, "out")
out2.SetDependencies([]string{"resource.network.cloud.id", "resource.container.test_dev"})

out2.Metadata().Checksum = types.Checksum{
Expand Down
11 changes: 6 additions & 5 deletions parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ func TestParseDoesNotProcessDisabledResources(t *testing.T) {
require.NoError(t, err)
require.True(t, r.GetDisabled())

require.Len(t, calls, 0)
// should have only be called for the variable
require.Len(t, calls, 1)
}

func TestParseDoesNotProcessDisabledResourcesWhenModuleDisabled(t *testing.T) {
Expand Down Expand Up @@ -542,8 +543,8 @@ func TestParseDoesNotProcessDisabledResourcesWhenModuleDisabled(t *testing.T) {
require.NoError(t, err)
require.True(t, r.GetDisabled())

// should only call once for the containing module
require.Len(t, calls, 1)
// should only called for the containing module and variables
require.Len(t, calls, 3)
}

func TestGetNameAndIndexReturnsCorrectDetails(t *testing.T) {
Expand Down Expand Up @@ -752,8 +753,8 @@ func TestParserStopsParseOnCallbackError(t *testing.T) {
_, err = p.ParseFile(absoluteFolderPath)
require.Error(t, err)

// only 7 of the resources should be created, none of the descendants of base
require.Len(t, calls, 9)
// only 13 of the resources and variables should be created, none of the descendants of base
require.Len(t, calls, 13)
require.NotContains(t, "resource.module.consul_1", calls)
}

Expand Down

0 comments on commit 851845c

Please sign in to comment.