@@ -27,13 +27,26 @@ describe('Dev Containers CLI', function () {
27
27
28
28
describe ( 'Command build' , ( ) => {
29
29
30
- it ( 'should build successfully with valid image metadata --label property' , async ( ) => {
30
+ it ( 'should build successfully with valid image metadata --label property (image) ' , async ( ) => {
31
31
const testFolder = `${ __dirname } /configs/example` ;
32
32
const response = await shellExec ( `${ cli } build --workspace-folder ${ testFolder } --label 'name=label-test' --label 'type=multiple-labels'` ) ;
33
33
const res = JSON . parse ( response . stdout ) ;
34
34
assert . equal ( res . outcome , 'success' ) ;
35
- const labels = await shellExec ( `docker inspect --format '{{json .Config.Labels}}' ${ res . imageName } | jq` ) ;
36
- assert . match ( labels . stdout . toString ( ) , / \" n a m e \" : \" l a b e l - t e s t \" / ) ;
35
+ const labelsResponse = await shellExec ( `docker inspect --format '{{json .Config.Labels}}' ${ res . imageName } ` ) ;
36
+ const labels = JSON . parse ( labelsResponse . stdout ) ;
37
+ assert . equal ( labels . name , 'label-test' ) ;
38
+ assert . equal ( labels . type , 'multiple-labels' ) ;
39
+ } ) ;
40
+
41
+ it ( 'should build successfully with valid image metadata --label property (dockerfile)' , async ( ) => {
42
+ const testFolder = `${ __dirname } /configs/example-dockerfile` ;
43
+ const response = await shellExec ( `${ cli } build --workspace-folder ${ testFolder } --label 'name=label-test' --label 'type=multiple-labels'` ) ;
44
+ const res = JSON . parse ( response . stdout ) ;
45
+ assert . equal ( res . outcome , 'success' ) ;
46
+ const labelsResponse = await shellExec ( `docker inspect --format '{{json .Config.Labels}}' ${ res . imageName } ` ) ;
47
+ const labels = JSON . parse ( labelsResponse . stdout ) ;
48
+ assert . equal ( labels . name , 'label-test' ) ;
49
+ assert . equal ( labels . type , 'multiple-labels' ) ;
37
50
} ) ;
38
51
39
52
it ( 'should fail to build with correct error message for local feature' , async ( ) => {
0 commit comments