| 912 | } |
| 913 | |
| 914 | func (ContainerSuite) TestWithoutVariable(ctx context.Context, t *testctx.T) { |
| 915 | res, err := testutil.Query[struct { |
| 916 | Container struct { |
| 917 | From struct { |
| 918 | WithoutEnvVariable struct { |
| 919 | EnvVariables []core.EnvVariable |
| 920 | WithExec struct { |
| 921 | Stdout string |
| 922 | } |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | }](t, |
| 927 | `{ |
| 928 | container { |
| 929 | from(address: "golang:1.18.2-alpine") { |
| 930 | withoutEnvVariable(name: "GOLANG_VERSION") { |
| 931 | envVariables { |
| 932 | name |
| 933 | value |
| 934 | } |
| 935 | withExec(args: ["env"]) { |
| 936 | stdout |
| 937 | } |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | }`, nil) |
| 942 | require.NoError(t, err) |
| 943 | require.Equal(t, res.Container.From.WithoutEnvVariable.EnvVariables, []core.EnvVariable{ |
| 944 | {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, |
| 945 | {Name: "GOPATH", Value: "/go"}, |
| 946 | }) |
| 947 | require.NotContains(t, res.Container.From.WithoutEnvVariable.WithExec.Stdout, "GOLANG_VERSION") |
| 948 | } |
| 949 | |
| 950 | func (ContainerSuite) TestEnvVariablesReplace(ctx context.Context, t *testctx.T) { |
| 951 | res, err := testutil.Query[struct { |