(t *testing.T)
| 193 | } |
| 194 | |
| 195 | func TestImageFromDockerfile(t *testing.T) { |
| 196 | t.Parallel() |
| 197 | for _, tc := range []struct { |
| 198 | content string |
| 199 | image string |
| 200 | }{{ |
| 201 | content: "FROM ubuntu", |
| 202 | image: "index.docker.io/library/ubuntu:latest", |
| 203 | }, { |
| 204 | content: "ARG VARIANT=bionic\nFROM ubuntu:$VARIANT", |
| 205 | image: "index.docker.io/library/ubuntu:bionic", |
| 206 | }, { |
| 207 | content: "ARG VARIANT=\"3.10\"\nFROM mcr.microsoft.com/devcontainers/python:0-${VARIANT}", |
| 208 | image: "mcr.microsoft.com/devcontainers/python:0-3.10", |
| 209 | }, { |
| 210 | content: "ARG VARIANT=\"3.10\"\nFROM mcr.microsoft.com/devcontainers/python:0-$VARIANT ", |
| 211 | image: "mcr.microsoft.com/devcontainers/python:0-3.10", |
| 212 | }} { |
| 213 | tc := tc |
| 214 | t.Run(tc.image, func(t *testing.T) { |
| 215 | t.Parallel() |
| 216 | ref, err := devcontainer.ImageFromDockerfile(tc.content, nil) |
| 217 | require.NoError(t, err) |
| 218 | require.Equal(t, tc.image, ref.Name()) |
| 219 | }) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | func TestImageFromDockerfile_BuildArgs(t *testing.T) { |
| 224 | t.Parallel() |
nothing calls this directly
no test coverage detected