MCPcopy Create free account
hub / github.com/coder/envbuilder / TestImageFromDockerfile

Function TestImageFromDockerfile

devcontainer/devcontainer_test.go:195–221  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

193}
194
195func 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
223func TestImageFromDockerfile_BuildArgs(t *testing.T) {
224 t.Parallel()

Callers

nothing calls this directly

Calls 2

ImageFromDockerfileFunction · 0.92
NameMethod · 0.45

Tested by

no test coverage detected