@@ -41,7 +41,7 @@ func TestParse(t *testing.T) {
41
41
func TestCompileWithFeatures (t * testing.T ) {
42
42
t .Parallel ()
43
43
registry := registrytest .New (t )
44
- featureOne := registrytest .WriteContainer (t , registry , "coder/test :tomato" , features .TarLayerMediaType , map [string ]any {
44
+ featureOne := registrytest .WriteContainer (t , registry , "coder/one :tomato" , features .TarLayerMediaType , map [string ]any {
45
45
"install.sh" : "hey" ,
46
46
"devcontainer-feature.json" : features.Spec {
47
47
ID : "rust" ,
@@ -53,7 +53,7 @@ func TestCompileWithFeatures(t *testing.T) {
53
53
},
54
54
},
55
55
})
56
- featureTwo := registrytest .WriteContainer (t , registry , "coder/test :potato" , features .TarLayerMediaType , map [string ]any {
56
+ featureTwo := registrytest .WriteContainer (t , registry , "coder/two :potato" , features .TarLayerMediaType , map [string ]any {
57
57
"install.sh" : "hey" ,
58
58
"devcontainer-feature.json" : features.Spec {
59
59
ID : "go" ,
@@ -63,10 +63,13 @@ func TestCompileWithFeatures(t *testing.T) {
63
63
ContainerEnv : map [string ]string {
64
64
"POTATO" : "example" ,
65
65
},
66
+ Options : map [string ]features.Option {
67
+ "version" : {
68
+ Type : "string" ,
69
+ },
70
+ },
66
71
},
67
72
})
68
- // Update the tag to ensure it comes from the feature value!
69
- featureTwoFake := strings .Join (append (strings .Split (featureTwo , ":" )[:2 ], "faketag" ), ":" )
70
73
71
74
raw := `{
72
75
"build": {
@@ -77,7 +80,7 @@ func TestCompileWithFeatures(t *testing.T) {
77
80
"image": "codercom/code-server:latest",
78
81
"features": {
79
82
"` + featureOne + `": {},
80
- "` + featureTwoFake + `": "potato"
83
+ "` + featureTwo + `": "potato"
81
84
}
82
85
}`
83
86
dc , err := devcontainer .Parse ([]byte (raw ))
@@ -95,12 +98,12 @@ func TestCompileWithFeatures(t *testing.T) {
95
98
require .Equal (t , `FROM codercom/code-server:latest
96
99
97
100
USER root
98
- # Go potato - Example description!
99
- ENV POTATO=example
100
- RUN .envbuilder/features/test-` + featureTwoSha + `/install.sh
101
101
# Rust tomato - Example description!
102
102
ENV TOMATO=example
103
- RUN .envbuilder/features/test-` + featureOneSha + `/install.sh
103
+ RUN .envbuilder/features/one-` + featureOneSha + `/install.sh
104
+ # Go potato - Example description!
105
+ ENV POTATO=example
106
+ RUN VERSION=potato .envbuilder/features/two-` + featureTwoSha + `/install.sh
104
107
USER 1000` , params .DockerfileContent )
105
108
}
106
109
0 commit comments