Skip to content

Commit

Permalink
fix incorrect aws schema load, add benchmark for schema load
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 25, 2023
1 parent 63944d5 commit f301551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/terraform/structure/tf_taggable.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import (
var TfTaggableResourceTypes []string

func init() {
linq.From(previousTaggableTypes(awsv4.Resources, isTaggableType, awsv2.Resources, awsv3.Resources, awsv4.Resources)).
loadSchema()
}

func loadSchema() {
linq.From(previousTaggableTypes(awsv5.Resources, isTaggableType, awsv2.Resources, awsv3.Resources, awsv4.Resources)).
Concat(linq.From(previousTaggableTypes(azurev3.Resources, isTaggableType, azurev2.Resources))).
Concat(linq.From(previousTaggableTypes(googlev4.Resources, isGoogleTaggableType, googlev2.Resources, googlev3.Resources))).
Concat(linq.From(taggableTypes(awsv5.Resources, isTaggableType))).
Expand Down
8 changes: 8 additions & 0 deletions src/terraform/structure/tf_taggable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ func TestKnownUntaggableResourcesShouldNotBeTaggable(t *testing.T) {
}
}
}

func BenchmarkInit(b *testing.B) {
loadSchema()
b.ResetTimer()
for i := 0; i < b.N; i++ {
loadSchema()
}
}

0 comments on commit f301551

Please sign in to comment.