Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
add default false for capacity_exhausted
Browse files Browse the repository at this point in the history
  • Loading branch information
dipak-pawar committed Nov 22, 2018
1 parent 11400cc commit 651123b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions migration/migration_blackbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,26 @@ func testMigration004AddCapacityExhaustedToCluster(t *testing.T) {
require.NoError(t, err)

assert.True(t, dialect.HasColumn("cluster", "capacity_exhausted"))

_, err = sqlDB.Exec(`INSERT INTO cluster (cluster_id, created_at, updated_at, name, url, console_url,
metrics_url, logging_url, app_dns, sa_token, sa_username, token_provider_id,
auth_client_id, auth_client_secret, auth_default_scope, type)
VALUES ('1b3d3751-69a7-4981-bf6f-63cd08b723af', now(), now(), 'exhausted', 'https://exhausted.api.cluster.com', 'https://console.cluster.com',
'https://metrics.cluster.com', 'https://login.cluster.com', 'https://app.cluster.com', 'sometoken', 'dssas-sre', 'pr-id',
'client-id', 'cleint-scr', 'somescope', 'OSD')`)
require.NoError(t, err)

// check if ALL the existing rows & new rows have the default value
rows, err := sqlDB.Query("SELECT capacity_exhausted FROM cluster")
fmt.Println(rows.Columns())
if err != nil {
t.Fatal(err)
}
defer rows.Close()
for rows.Next() {
var capacity_exhausted bool
err = rows.Scan(&capacity_exhausted)
require.NoError(t, err)
assert.False(t, capacity_exhausted)
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-- Store capacity_exhausted for cluster
ALTER TABLE cluster ADD COLUMN capacity_exhausted boolean;
ALTER TABLE cluster ADD COLUMN capacity_exhausted boolean NOT NULL DEFAULT FALSE;

0 comments on commit 651123b

Please sign in to comment.