@@ -82,18 +82,32 @@ func TestBuildFromDevcontainerWithFeatures(t *testing.T) {
82
82
t .Parallel ()
83
83
84
84
registry := registrytest .New (t )
85
- ref := registrytest .WriteContainer (t , registry , "coder/test :latest" , features .TarLayerMediaType , map [string ]any {
85
+ feature1Ref := registrytest .WriteContainer (t , registry , "coder/test1 :latest" , features .TarLayerMediaType , map [string ]any {
86
86
"devcontainer-feature.json" : & features.Spec {
87
- ID : "test " ,
88
- Name : "test " ,
87
+ ID : "test1 " ,
88
+ Name : "test1 " ,
89
89
Version : "1.0.0" ,
90
90
Options : map [string ]features.Option {
91
91
"bananas" : {
92
92
Type : "string" ,
93
93
},
94
94
},
95
95
},
96
- "install.sh" : "echo $BANANAS > /test" ,
96
+ "install.sh" : "echo $BANANAS > /test1output" ,
97
+ })
98
+
99
+ feature2Ref := registrytest .WriteContainer (t , registry , "coder/test2:latest" , features .TarLayerMediaType , map [string ]any {
100
+ "devcontainer-feature.json" : & features.Spec {
101
+ ID : "test2" ,
102
+ Name : "test2" ,
103
+ Version : "1.0.0" ,
104
+ Options : map [string ]features.Option {
105
+ "pineapple" : {
106
+ Type : "string" ,
107
+ },
108
+ },
109
+ },
110
+ "install.sh" : "echo $PINEAPPLE > /test2output" ,
97
111
})
98
112
99
113
// Ensures that a Git repository with a devcontainer.json is cloned and built.
@@ -105,8 +119,11 @@ func TestBuildFromDevcontainerWithFeatures(t *testing.T) {
105
119
"dockerfile": "Dockerfile"
106
120
},
107
121
"features": {
108
- "` + ref + `": {
109
- "bananas": "hello"
122
+ "` + feature1Ref + `": {
123
+ "bananas": "hello from test 1!"
124
+ },
125
+ "` + feature2Ref + `": {
126
+ "pineapple": "hello from test 2!"
110
127
}
111
128
}
112
129
}` ,
@@ -118,8 +135,11 @@ func TestBuildFromDevcontainerWithFeatures(t *testing.T) {
118
135
}})
119
136
require .NoError (t , err )
120
137
121
- output := execContainer (t , ctr , "cat /test" )
122
- require .Equal (t , "hello" , strings .TrimSpace (output ))
138
+ test1Output := execContainer (t , ctr , "cat /test1output" )
139
+ require .Equal (t , "hello from test 1!" , strings .TrimSpace (test1Output ))
140
+
141
+ test2Output := execContainer (t , ctr , "cat /test2output" )
142
+ require .Equal (t , "hello from test 2!" , strings .TrimSpace (test2Output ))
123
143
}
124
144
125
145
func TestBuildFromDockerfile (t * testing.T ) {
0 commit comments