Skip to content

Commit

Permalink
[Internal] Fix billing test for budget configuration update (#1019)
Browse files Browse the repository at this point in the history
## Changes
<!-- Summary of your changes that are easy to understand -->
* we are getting 1 error on update budget consistently around 2:30 UTC
every day. Looking into this the budget that errors is named with
`go-sdk-...` so I found it's coming from this test
<img width="552" alt="image"
src="https://github.com/user-attachments/assets/59e4ca5f-3dd7-4450-8619-a5ca38b5731d">

* this change should fix the error because it provides an ID for the
alert and action configurations being updated. The alert ID is necessary
on an update because we only allow 1 alert and providing no ID will
attempt to create a new alert instead of updating the existing one.


## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [ ] `make test` passing
fails but does not seem related:
```
=== FAIL: config TestConfig_HostEnv (0.02s)
2024/08/15 09:06:23 [DEBUG] Running command: /opt/homebrew/Cellar/databricks/0.209.0/bin/databricks auth token --host https://x
    auth_permutations_test.go:87:
                Error Trace:    /Users/rachel.pinsker/databricks-sdk-forks/databricks-sdk-go/config/auth_permutations_test.go:87
                                                        /Users/rachel.pinsker/databricks-sdk-forks/databricks-sdk-go/config/auth_permutations_test.go:139
                Error:          Not equal:
                                expected: "default auth: cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method. Config: host=https://x. Env: DATABRICKS_HOST"
                                actual  : "default auth: databricks-cli: cannot get access token: Error: cannot load Databricks config file: open /Users/rachel.pinsker/databricks-sdk-forks/databricks-sdk-go/config/.databrickscfg: no such file or directory\n. Config: host=https://x. Env: DATABRICKS_HOST"
```
- [x] `make fmt` applied
- [ ] relevant integration tests applied
[prerequisites
here](https://databricks.atlassian.net/wiki/spaces/UN/pages/3097952898/Go+SDK+Automation+Integration+test+coverage+creating+Github+issues+and+generating+examples+from+tests)
are not working
  • Loading branch information
rachel-db authored Aug 20, 2024
1 parent 27a5055 commit f624809
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions internal/billing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ func TestMwsAccBudgets(t *testing.T) {

BudgetId: created.Budget.BudgetConfigurationId,
Budget: billing.UpdateBudgetConfigurationBudget{
DisplayName: RandomName("go-sdk-updated-"),
BudgetConfigurationId: created.Budget.BudgetConfigurationId,
DisplayName: RandomName("go-sdk-updated-"),
Filter: &billing.BudgetConfigurationFilter{
Tags: []billing.BudgetConfigurationFilterTagClause{
{
Expand All @@ -136,16 +137,12 @@ func TestMwsAccBudgets(t *testing.T) {
}},
AlertConfigurations: []billing.AlertConfiguration{
{
TimePeriod: billing.AlertConfigurationTimePeriodMonth,
QuantityType: billing.AlertConfigurationQuantityTypeListPriceDollarsUsd,
TriggerType: billing.AlertConfigurationTriggerTypeCumulativeSpendingExceeded,
QuantityThreshold: "50",
ActionConfigurations: []billing.ActionConfiguration{
{
ActionType: billing.ActionConfigurationTypeEmailNotification,
Target: "admin@example.com",
},
},
AlertConfigurationId: created.Budget.AlertConfigurations[0].AlertConfigurationId,
TimePeriod: billing.AlertConfigurationTimePeriodMonth,
QuantityType: billing.AlertConfigurationQuantityTypeListPriceDollarsUsd,
TriggerType: billing.AlertConfigurationTriggerTypeCumulativeSpendingExceeded,
QuantityThreshold: "50",
ActionConfigurations: created.Budget.AlertConfigurations[0].ActionConfigurations,
},
},
},
Expand Down

0 comments on commit f624809

Please sign in to comment.