Skip to content

Commit

Permalink
See about unbreaking tests following upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
diab42 committed Oct 30, 2024
1 parent 9284155 commit 8d59bc5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ func (r *domainAllowlistResource) Read(ctx context.Context, request resource.Rea
}
domainAllowListData := resp.GetData()

apiEntries, ok := domainAllowListData.Attributes.GetDomainsOk()
apiDomains, ok := domainAllowListData.Attributes.GetDomainsOk()
priorEntries := state.Domains

if !compareDomainEntries(priorEntries, *apiEntries) && ok && priorEntries != nil {
r.updateDomainAllowlistEntriesState(ctx, &state, *apiEntries)
if !compareDomainEntries(priorEntries, *apiDomains) && ok && priorEntries != nil {
state.Domains = *apiDomains
}

r.updateEnableState(ctx, &state, domainAllowListData.GetAttributes())
Expand Down Expand Up @@ -184,7 +184,7 @@ func (r *domainAllowlistResource) updateRequestState(ctx context.Context, state
}

if domains, ok := domainAllowlistAttrs.GetDomainsOk(); ok && len(*domains) > 0 {
r.updateDomainAllowlistEntriesState(ctx, state, *domains)
state.Domains = domainAllowlistAttrs.GetDomains()
}
}
}
Expand All @@ -195,12 +195,6 @@ func (r *domainAllowlistResource) updateEnableState(ctx context.Context, state *
}
}

func (r *domainAllowlistResource) updateDomainAllowlistEntriesState(ctx context.Context, state *domainAllowlistResourceModel, domainAllowlistEntries []string) {
var domains []string
domains = append(domains, domainAllowlistEntries...)
state.Domains = domains
}

func buildDomainAllowlistUpdateRequest(state domainAllowlistResourceModel) (*datadogV2.DomainAllowlistRequest, error) {
domainAllowlistRequest := datadogV2.NewDomainAllowlistRequestWithDefaults()
domainAllowlistData := datadogV2.NewDomainAllowlist(datadogV2.DOMAINALLOWLISTTYPE_DOMAIN_ALLOWLIST)
Expand Down
1 change: 0 additions & 1 deletion datadog/resource_datadog_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -8068,7 +8068,6 @@ func buildDatadogToplistStyle(terraformToplistStyle map[string]interface{}) data
if t == "stacked" {
datadogToplistStyle.SetDisplay(datadogV1.ToplistWidgetDisplay{
ToplistWidgetStacked: datadogV1.NewToplistWidgetStacked(
datadogV1.TOPLISTWIDGETLEGEND_AUTOMATIC,
datadogV1.TOPLISTWIDGETSTACKEDTYPE_STACKED,
),
})
Expand Down
5 changes: 1 addition & 4 deletions datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -3114,10 +3114,7 @@ func buildDatadogTestOptions(d *schema.ResourceData) *datadogV1.SyntheticsTestOp
if rawTimeframes, ok := scheduling.(map[string]interface{})["timeframes"]; ok {
var timeFrames []datadogV1.SyntheticsTestOptionsSchedulingTimeframe
for _, tf := range rawTimeframes.(*schema.Set).List() {
timeframe := datadogV1.NewSyntheticsTestOptionsSchedulingTimeframe()
timeframe.SetDay(int32(tf.(map[string]interface{})["day"].(int)))
timeframe.SetFrom(tf.(map[string]interface{})["from"].(string))
timeframe.SetTo(tf.(map[string]interface{})["to"].(string))
timeframe := datadogV1.NewSyntheticsTestOptionsSchedulingTimeframe(int32(tf.(map[string]interface{})["day"].(int)), tf.(map[string]interface{})["from"].(string), tf.(map[string]interface{})["to"].(string))
timeFrames = append(timeFrames, *timeframe)
}
optionsScheduling.SetTimeframes(timeFrames)
Expand Down
1 change: 1 addition & 0 deletions datadog/tests/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ var testFiles2EndpointTags = map[string]string{
"tests/resource_datadog_dashboard_topology_map_test": "dashboards",
"tests/resource_datadog_dashboard_trace_service_test": "dashboards",
"tests/resource_datadog_dashboard_treemap_test": "dashboards",
"tests/resource_datadog_domain_allowlist_test": "domain-allowlist",
"tests/resource_datadog_openapi_api_test": "apimanagement",
"tests/resource_datadog_powerpack_test": "powerpacks",
"tests/resource_datadog_powerpack_alert_graph_test": "powerpacks",
Expand Down

0 comments on commit 8d59bc5

Please sign in to comment.