@@ -54,28 +54,42 @@ func Test_DefaultVersionStrategy_AllGolangDistributions(t *testing.T) {
5454 "windows/arm" : {"windows" , "arm" },
5555 }
5656
57+ versionDifferences := map [PostgresVersion ]map [string ][]string {
58+ PostgresVersion ("14.0.0" ): {},
59+ PostgresVersion ("14.1.0" ): {},
60+ PostgresVersion ("14.2.0" ): {"darwin/arm64" : {"darwin" , "arm64v8" }},
61+ V14 : {"darwin/arm64" : {"darwin" , "arm64v8" }},
62+ }
5763 defaultConfig := DefaultConfig ()
5864
59- for dist , expected := range allGolangDistributions {
60- dist := dist
61- expected := expected
62-
63- t .Run (fmt .Sprintf ("DefaultVersionStrategy_%s" , dist ), func (t * testing.T ) {
64- osArch := strings .Split (dist , "/" )
65-
66- operatingSystem , architecture , postgresVersion := defaultVersionStrategy (
67- defaultConfig ,
68- osArch [0 ],
69- osArch [1 ],
70- linuxMachineName ,
71- func () bool {
72- return false
73- })()
74-
75- assert .Equal (t , expected [0 ], operatingSystem )
76- assert .Equal (t , expected [1 ], architecture )
77- assert .Equal (t , V14 , postgresVersion )
78- })
65+ for version , differences := range versionDifferences {
66+ defaultConfig .version = version
67+
68+ for dist , expected := range allGolangDistributions {
69+ dist := dist
70+ expected := expected
71+
72+ if override , ok := differences [dist ]; ok {
73+ expected = override
74+ }
75+
76+ t .Run (fmt .Sprintf ("DefaultVersionStrategy_%s" , dist ), func (t * testing.T ) {
77+ osArch := strings .Split (dist , "/" )
78+
79+ operatingSystem , architecture , postgresVersion := defaultVersionStrategy (
80+ defaultConfig ,
81+ osArch [0 ],
82+ osArch [1 ],
83+ linuxMachineName ,
84+ func () bool {
85+ return false
86+ })()
87+
88+ assert .Equal (t , expected [0 ], operatingSystem )
89+ assert .Equal (t , expected [1 ], architecture )
90+ assert .Equal (t , version , postgresVersion )
91+ })
92+ }
7993 }
8094}
8195
0 commit comments