Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Trofimov <qwerty65k@mail.ru>
  • Loading branch information
GOodCoffeeLover committed Aug 26, 2023
1 parent b786cb4 commit 199784f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pkg/storage/driver/sql_test.go
Expand Up @@ -21,6 +21,7 @@ import (
"time"

sqlmock "github.com/DATA-DOG/go-sqlmock"
migrate "github.com/rubenv/sql-migrate"

rspb "helm.sh/helm/v3/pkg/release"
)
Expand Down Expand Up @@ -530,3 +531,38 @@ func mockGetReleaseCustomLabels(mock sqlmock.Sqlmock, key string, namespace stri
}
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)
}

}

0 comments on commit 199784f

Please sign in to comment.