MCPcopy
hub / github.com/helm/helm / newTestFixtureSQL

Function newTestFixtureSQL

pkg/storage/driver/mock_test.go:262–275  ·  view source on GitHub ↗

newTestFixtureSQL mocks the SQL database (for testing purposes)

(t *testing.T, _ ...*rspb.Release)

Source from the content-addressed store, hash-verified

260
261// newTestFixtureSQL mocks the SQL database (for testing purposes)
262func newTestFixtureSQL(t *testing.T, _ ...*rspb.Release) (*SQL, sqlmock.Sqlmock) {
263 t.Helper()
264 sqlDB, mock, err := sqlmock.New()
265 if err != nil {
266 t.Fatalf("error when opening stub database connection: %v", err)
267 }
268
269 sqlxDB := sqlx.NewDb(sqlDB, "sqlmock")
270 return &SQL{
271 db: sqlxDB,
272 namespace: "default",
273 statementBuilder: sq.StatementBuilder.PlaceholderFormat(sq.Dollar),
274 }, mock
275}

Callers 9

TestSQLNameFunction · 0.85
TestSQLGetFunction · 0.85
TestSQLListFunction · 0.85
TestSqlCreateFunction · 0.85
TestSqlUpdateFunction · 0.85
TestSqlQueryFunction · 0.85
TestSqlDeleteFunction · 0.85

Calls 2

HelperMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…