|
|
|
@ -292,6 +292,11 @@ func TestSqlUpdate(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestSqlQuery(t *testing.T) {
|
|
|
|
|
// Reflect actual use cases in ../storage.go
|
|
|
|
|
labelSetUnknown := map[string]string{
|
|
|
|
|
"name": "smug-pigeon",
|
|
|
|
|
"owner": sqlReleaseDefaultOwner,
|
|
|
|
|
"status": "unknown",
|
|
|
|
|
}
|
|
|
|
|
labelSetDeployed := map[string]string{
|
|
|
|
|
"name": "smug-pigeon",
|
|
|
|
|
"owner": sqlReleaseDefaultOwner,
|
|
|
|
@ -320,6 +325,15 @@ func TestSqlQuery(t *testing.T) {
|
|
|
|
|
sqlReleaseTableNamespaceColumn,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
mock.
|
|
|
|
|
ExpectQuery(regexp.QuoteMeta(query)).
|
|
|
|
|
WithArgs("smug-pigeon", sqlReleaseDefaultOwner, "unknown", "default").
|
|
|
|
|
WillReturnRows(
|
|
|
|
|
mock.NewRows([]string{
|
|
|
|
|
sqlReleaseTableBodyColumn,
|
|
|
|
|
}),
|
|
|
|
|
).RowsWillBeClosed()
|
|
|
|
|
|
|
|
|
|
mock.
|
|
|
|
|
ExpectQuery(regexp.QuoteMeta(query)).
|
|
|
|
|
WithArgs("smug-pigeon", sqlReleaseDefaultOwner, "deployed", "default").
|
|
|
|
@ -353,6 +367,13 @@ func TestSqlQuery(t *testing.T) {
|
|
|
|
|
),
|
|
|
|
|
).RowsWillBeClosed()
|
|
|
|
|
|
|
|
|
|
_, err := sqlDriver.Query(labelSetUnknown)
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Errorf("Expected error {%v}, got nil", ErrReleaseNotFound)
|
|
|
|
|
} else if err != ErrReleaseNotFound {
|
|
|
|
|
t.Fatalf("failed to query for unknown smug-pigeon release: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
results, err := sqlDriver.Query(labelSetDeployed)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("failed to query for deployed smug-pigeon release: %v", err)
|
|
|
|
|