MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / TestRuntimeVersion

Function TestRuntimeVersion

pkg/python/python_test.go:28–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26 gcp "github.com/GoogleCloudPlatform/buildpacks/pkg/gcpbuildpack"
27)
28
29func TestRuntimeVersion(t *testing.T) {
30 testCases := []struct {
31 name string
32 version string
33 runtimeVersion string
34 versionFile string
35 want string
36 wantErr bool
37 wantMatch bool
38 wantMatchErr bool
39 stackID string
40 }{
41 {
42 name: "default_to_latest_for_default_stack_ubuntu2404_is_default_for_unit_tests",
43 want: "3.14.*",
44 },
45 {
46 name: "default_to_latest_for_stack_ubuntu2404",
47 stackID: "google.24.full",
48 want: "3.14.*",
49 },
50 {
51 name: "default_to_latest_for_stack_ubuntu1804",
52 stackID: "google.gae.18",
53 want: "3.9.*",
54 },
55 {
56 name: "version_from_GOOGLE_PYTHON_VERSION",
57 version: "3.8.0",
58 want: "3.8.0",
59 },
60 {
61 name: "version_from_GOOGLE_RUNTIME_VERSION",
62 runtimeVersion: "3.8.0",
63 want: "3.8.0",
64 },
65 {
66 name: "GOOGLE_PYTHON_VERSION_take_precedence_over_GOOGLE_RUNTIME_VERSION",
67 version: "3.8.0",
68 runtimeVersion: "3.8.1",
69 want: "3.8.0",
70 },
71 {
72 name: "version_from_.python-version_file",
73 versionFile: "3.8.0",
74 want: "3.8.0",
75 },
76 {
77 name: "empty_.python-version_file",
78 versionFile: " ",
79 wantErr: true,
80 },
81 {
82 name: "GOOGLE_RUNTIME_VERSION_take_precedence_over_.python-version",
83 runtimeVersion: "3.8.0",
84 versionFile: "3.8.1",
85 want: "3.8.0",

Callers

nothing calls this directly

Calls 4

TempDirMethod · 0.80
SetenvMethod · 0.80
WriteFileMethod · 0.80
RuntimeVersionFunction · 0.70

Tested by

no test coverage detected