MCPcopy
hub / github.com/perkeep/perkeep / TestPostgreSQLKV

Function TestPostgreSQLKV

pkg/sorted/postgres/postgreskv_test.go:30–47  ·  view source on GitHub ↗

TestPostgreSQLKV tests against a real PostgreSQL instance, using a Docker container.

(t *testing.T)

Source from the content-addressed store, hash-verified

28
29// TestPostgreSQLKV tests against a real PostgreSQL instance, using a Docker container.
30func TestPostgreSQLKV(t *testing.T) {
31 dbname := "camlitest_" + osutil.Username()
32 containerID, ip := dockertest.SetupPostgreSQLContainer(t, dbname)
33 defer containerID.KillRemove(t)
34
35 kv, err := sorted.NewKeyValue(jsonconfig.Obj{
36 "type": "postgres",
37 "host": ip,
38 "database": dbname,
39 "user": dockertest.PostgresUsername,
40 "password": dockertest.PostgresPassword,
41 "sslmode": "disable",
42 })
43 if err != nil {
44 t.Fatalf("postgres.NewKeyValue = %v", err)
45 }
46 kvtest.TestSorted(t, kv)
47}
48
49func TestPostgresDBNaming(t *testing.T) {
50 cases := []struct {

Callers

nothing calls this directly

Calls 6

UsernameFunction · 0.92
SetupPostgreSQLContainerFunction · 0.92
NewKeyValueFunction · 0.92
TestSortedFunction · 0.92
KillRemoveMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected