MCPcopy Create free account
hub / github.com/ddev/ddev / GetDBTypeVersionFromString

Function GetDBTypeVersionFromString

pkg/ddevapp/db_test.go:19–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func GetDBTypeVersionFromString(t *testing.T) {
20 expectations := map[string]string{
21 "9": "postgres:9",
22 "9.6": "postgres:9",
23 "10": "postgres:10",
24 "11": "postgres:11",
25 "12": "postgres:12",
26 "13": "postgres:13",
27 "14": "postgres:14",
28 "15": "postgres:15",
29 "16": "postgres:16",
30 "17": "postgres:17",
31 "18": "postgres:18", // PostgreSQL 18 support
32 "19": "postgres:19", // Future PostgreSQL versions
33 "20": "postgres:20",
34 "5.5": "mariadb:5.5",
35 "5.6": "mysql:5.6",
36 "5.7": "mysql:5.7",
37 "8.0": "mysql:8.0",
38 "10.0": "mariadb:10.0",
39 "10.1": "mariadb:10.1",
40 "10.2": "mariadb:10.2",
41 "10.3": "mariadb:10.3",
42 "10.4": "mariadb:10.4",
43 "10.5": "mariadb:10.5",
44 "10.6": "mariadb:10.6",
45 "10.7": "mariadb:10.7",
46
47 "mariadb_10.2": "mariadb:10.2",
48 "mariadb_10.3": "mariadb:10.3",
49 "mariadb_10.4": "mariadb:10.4",
50 "mariadb_10.7": "mariadb:10.7",
51 "mariadb_10.11": "mariadb:10.11",
52 "mariadb_11.4": "mariadb:11.4",
53 "mariadb_11.8": "mariadb:11.8",
54 "mysql_5.7": "mysql:5.7",
55 "mysql_8.0": "mysql:8.0",
56 "mysql_8.4": "mysql:8.4",
57 }
58
59 for input, expectation := range expectations {
60 require.Equal(t, expectation, ddevapp.GetDBTypeVersionFromString(input))
61 }
62}
63
64// TestGetDBVersionFromVolumeScript tests the shell script logic used in GetDBVersionFromVolume
65// to ensure it properly detects PostgreSQL 18+ directory structures

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected