fix conflict

Signed-off-by: Maxim Trofimov <qwerty65k@mail.ru>
pull/12019/head
Maxim Trofimov 1 year ago
parent b786cb40f0
commit 199784f711

@ -21,6 +21,7 @@ import (
"time" "time"
sqlmock "github.com/DATA-DOG/go-sqlmock" sqlmock "github.com/DATA-DOG/go-sqlmock"
migrate "github.com/rubenv/sql-migrate"
rspb "helm.sh/helm/v3/pkg/release" rspb "helm.sh/helm/v3/pkg/release"
) )
@ -530,3 +531,38 @@ func mockGetReleaseCustomLabels(mock sqlmock.Sqlmock, key string, namespace stri
} }
eq.WillReturnRows(returnRows).RowsWillBeClosed() eq.WillReturnRows(returnRows).RowsWillBeClosed()
} }
func TestCheckAlreadyAppliedFind(t *testing.T) {
sqlDriver, mock := newTestFixtureSQL(t)
initID := "init"
testMigrations := []*migrate.Migration{{Id: initID}}
mock.
ExpectQuery("").
WillReturnRows(
sqlmock.NewRows([]string{"id", "applied_at"}).
AddRow(initID, time.Time{}))
mock.ExpectCommit()
if !sqlDriver.checkAlreadyApplied(testMigrations) {
t.Errorf("Did not find init id: %v", initID)
}
}
func TestCheckAlreadyAppliedNotFind(t *testing.T) {
sqlDriver, mock := newTestFixtureSQL(t)
initID := "init"
testMigrations := []*migrate.Migration{{Id: initID}}
mock.
ExpectQuery("").
WillReturnRows(
sqlmock.NewRows([]string{"id", "applied_at"}).
AddRow("1", time.Time{}).
AddRow("2", time.Time{}))
mock.ExpectCommit()
if sqlDriver.checkAlreadyApplied(testMigrations) {
t.Errorf("Did find init id: %v, that not exists", initID)
}
}

Loading…
Cancel
Save