(mock sqlmock.Sqlmock, key string, namespace string, labels map[string]string)
| 555 | } |
| 556 | |
| 557 | func mockGetReleaseCustomLabels(mock sqlmock.Sqlmock, key string, namespace string, labels map[string]string) { |
| 558 | query := fmt.Sprintf( |
| 559 | regexp.QuoteMeta("SELECT %s, %s FROM %s WHERE %s = $1 AND %s = $2"), |
| 560 | sqlCustomLabelsTableKeyColumn, |
| 561 | sqlCustomLabelsTableValueColumn, |
| 562 | sqlCustomLabelsTableName, |
| 563 | sqlCustomLabelsTableReleaseKeyColumn, |
| 564 | sqlCustomLabelsTableReleaseNamespaceColumn, |
| 565 | ) |
| 566 | |
| 567 | eq := mock.ExpectQuery(query). |
| 568 | WithArgs(key, namespace) |
| 569 | |
| 570 | returnRows := mock.NewRows([]string{ |
| 571 | sqlCustomLabelsTableKeyColumn, |
| 572 | sqlCustomLabelsTableValueColumn, |
| 573 | }) |
| 574 | for k, v := range labels { |
| 575 | returnRows.AddRow(k, v) |
| 576 | } |
| 577 | eq.WillReturnRows(returnRows).RowsWillBeClosed() |
| 578 | } |
| 579 | |
| 580 | func TestSqlCheckAppliedMigrations(t *testing.T) { |
| 581 | cases := []struct { |
no outgoing calls
no test coverage detected
searching dependent graphs…