Skip to content

Commit 4df467e

Browse files
GODRIVER-3493 Target 1.18 for compile check
1 parent f8026c8 commit 4df467e

File tree

4 files changed

+19
-67
lines changed

4 files changed

+19
-67
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,9 +1427,7 @@ tasks:
14271427
- command: subprocess.exec
14281428
params:
14291429
binary: bash
1430-
env:
1431-
GO_VERSION: "1.18"
1432-
args: [*task-runner, build-compile-check]
1430+
args: [*task-runner, build-compile-check-msv]
14331431

14341432
# Build with the same Go version that we're using for tests.
14351433
- name: build

Taskfile.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ tasks:
3030

3131
build-compile-check: bash etc/run-compile-check-test.sh
3232

33+
build-compile-check-msv: bash etc/run-compile-check-test.sh TestCompileCheck/golang:1.18
34+
3335
build-aws-ecs-test: go build ${BUILD_TAGS} ./internal/cmd/testaws/main.go
3436

3537
cross-compile:

etc/run-compile-check-test.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
set -eu
55
set +x
66

7+
SUBTEST=$1
8+
79
echo "Running internal/test/compilecheck"
810
pushd internal/test/compilecheck
9-
GOWORK=off go test -v ./... >>../../../test.suite
11+
if [ -n "${SUBTEST-}" ]; then
12+
# If $1 is set and non-empty, use it with -run
13+
GOWORK=off go test -run "$SUBTEST" -timeout 30m -v ./... >>../../../test.suite
14+
else
15+
# If $1 is not set, run tests without -run
16+
GOWORK=off go test -timeout 30m -v ./... >>../../../test.suite
17+
fi
1018
popd

internal/test/compilecheck/compile_check_test.go

Lines changed: 7 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,11 @@ import (
2020
const minSupportedVersion = "1.18"
2121

2222
func TestCompileCheck(t *testing.T) {
23-
//ctx := context.Background()
24-
25-
//req := testcontainers.ContainerRequest{
26-
// Image: "alpine",
27-
// Cmd: []string{"tail", "-f", "/dev/null"},
28-
// WaitingFor: wait.ForExec([]string{"echo", "hello world"}).WithExitCode(0),
29-
//}
30-
31-
//container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
32-
// ContainerRequest: req,
33-
// Started: true,
34-
//})
35-
36-
//require.NoError(t, err)
37-
38-
//defer func() {
39-
// err := container.Terminate(ctx)
40-
// require.NoError(t, err)
41-
//}()
4223
cwd, err := os.Getwd()
4324
require.NoError(t, err)
4425

4526
internalDir := filepath.Dir(filepath.Dir(filepath.Dir(cwd)))
4627

47-
fmt.Println(internalDir)
48-
49-
//versions, err := getAllGoVersions()
50-
//require.NoError(t, err)
51-
//
5228
versions, err := getDockerGolangImages()
5329
require.NoError(t, err)
5430

@@ -57,27 +33,26 @@ func TestCompileCheck(t *testing.T) {
5733

5834
image := fmt.Sprintf("golang:%s", version)
5935
t.Run(image, func(t *testing.T) {
36+
t.Parallel()
37+
6038
req := testcontainers.ContainerRequest{
6139
Image: image,
62-
//Entrypoint: []string{"/bin/sh", "-c"},
63-
64-
Cmd: []string{"tail", "-f", "/dev/null"},
40+
Cmd: []string{"tail", "-f", "/dev/null"},
6541
Mounts: []testcontainers.ContainerMount{
6642
testcontainers.BindMount(internalDir, "/workspace"),
6743
},
6844
WorkingDir: "/workspace",
6945
Env: map[string]string{
7046
"GO_VERSION": version,
7147
},
72-
//WaitingFor: wait.ForExit().WithExitCode(0),
73-
//WaitingFor: wait.ForExec([]string{"bash", "compile_check.sh"}).WithExitCode(0),
7448
}
7549

76-
container, err := testcontainers.GenericContainer(context.Background(), testcontainers.GenericContainerRequest{
50+
genReq := testcontainers.GenericContainerRequest{
7751
ContainerRequest: req,
7852
Started: true,
79-
})
53+
}
8054

55+
container, err := testcontainers.GenericContainer(context.Background(), genReq)
8156
require.NoError(t, err)
8257

8358
defer func() {
@@ -165,7 +140,7 @@ func getDockerGolangImages() ([]string, error) {
165140
continue
166141
}
167142

168-
// Skip release candidates
143+
// Skip release candidates.
169144
if strings.Contains(base, "rc") {
170145
continue
171146
}
@@ -198,34 +173,3 @@ func getDockerGolangImages() ([]string, error) {
198173

199174
return versions, nil
200175
}
201-
202-
//func getAllGoVersions() ([]string, error) {
203-
// resp, err := http.Get("https://golang.org/dl/?mode=json&include=all")
204-
// if err != nil {
205-
// return nil, fmt.Errorf("failed to get response from golang.org: %v", err)
206-
// }
207-
//
208-
// defer resp.Body.Close()
209-
//
210-
// var releases []struct {
211-
// Version string `json:"version"`
212-
// }
213-
//
214-
// if err := json.NewDecoder(resp.Body).Decode(&releases); err != nil {
215-
// return nil, fmt.Errorf("failed to decode response body: %v", err)
216-
// }
217-
//
218-
// versions := []string{}
219-
// for _, r := range releases {
220-
// if len(r.Version) < 3 || r.Version[:2] != "go" {
221-
// continue
222-
// }
223-
//
224-
// v := "v" + r.Version[2:]
225-
// if semver.Compare(v, minSupportedVersion) >= 0 {
226-
// versions = append(versions, v[1:])
227-
// }
228-
// }
229-
//
230-
// return versions, nil
231-
//}

0 commit comments

Comments
 (0)