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