Skip to content

Commit

Permalink
Merge pull request #1581 from snyk/fix_acc_tests
Browse files Browse the repository at this point in the history
Fix acceptance tests
  • Loading branch information
eliecharra authored Aug 11, 2022
2 parents cc6e2ca + c370036 commit b1cf4b5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
14 changes: 9 additions & 5 deletions enumeration/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,18 @@ func (a *Attributes) GetBool(path string) *bool {
}

func (a *Attributes) GetInt(path string) *int {
// This is a nonsense, if we want to retrieve an int this is gonna fail
// We were doing that because all numbers fields from cty are float64 but sometimes we want to retrieve an int
// TODO Change this to be compatible with both int and float64 underlying type
val := a.GetFloat64(path)
val, exist := (*a)[path]
if !exist {
return nil
}
if v, isInt := val.(int); isInt {
return &v
}
floatVal := a.GetFloat64(path)
if val == nil {
return nil
}
v := int(*val)
v := int(*floatVal)
return &v
}

Expand Down
16 changes: 16 additions & 0 deletions pkg/resource/schemas/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ func (r *SchemaRepository) fetchNestedBlocks(root string, metadata map[string]re
}

func (r *SchemaRepository) Init(providerName, providerVersion string, schema map[string]providers.Schema) error {

if providerVersion == "" {
switch providerName {
case "aws":
providerVersion = "3.19.0"
case "github":
providerVersion = "4.4.0"
case "google":
providerVersion = "3.78.0"
case "azurerm":
providerVersion = "2.71.0"
default:
return errors.Errorf("unsupported remote '%s'", providerName)
}
}

v, err := version.NewVersion(providerVersion)
if err != nil {
return err
Expand Down

0 comments on commit b1cf4b5

Please sign in to comment.