@@ -73,7 +73,7 @@ func TestCompile(t *testing.T) {
73
73
t .Run ("UnknownOption" , func (t * testing.T ) {
74
74
t .Parallel ()
75
75
spec := & features.Spec {}
76
- _ , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , map [string ]any {
76
+ _ , _ , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , map [string ]any {
77
77
"unknown" : "value" ,
78
78
})
79
79
require .ErrorContains (t , err , "unknown option" )
@@ -83,7 +83,7 @@ func TestCompile(t *testing.T) {
83
83
spec := & features.Spec {
84
84
Directory : "/" ,
85
85
}
86
- directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , nil )
86
+ _ , directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , nil )
87
87
require .NoError (t , err )
88
88
require .Equal (t , "WORKDIR /\n RUN _CONTAINER_USER=\" containerUser\" _REMOTE_USER=\" remoteUser\" ./install.sh" , strings .TrimSpace (directive ))
89
89
})
@@ -95,7 +95,7 @@ func TestCompile(t *testing.T) {
95
95
"FOO" : "bar" ,
96
96
},
97
97
}
98
- directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , nil )
98
+ _ , directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , nil )
99
99
require .NoError (t , err )
100
100
require .Equal (t , "WORKDIR /\n ENV FOO=bar\n RUN _CONTAINER_USER=\" containerUser\" _REMOTE_USER=\" remoteUser\" ./install.sh" , strings .TrimSpace (directive ))
101
101
})
@@ -109,7 +109,7 @@ func TestCompile(t *testing.T) {
109
109
},
110
110
},
111
111
}
112
- directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , nil )
112
+ _ , directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , false , nil )
113
113
require .NoError (t , err )
114
114
require .Equal (t , "WORKDIR /\n RUN FOO=\" bar\" _CONTAINER_USER=\" containerUser\" _REMOTE_USER=\" remoteUser\" ./install.sh" , strings .TrimSpace (directive ))
115
115
})
@@ -118,8 +118,9 @@ func TestCompile(t *testing.T) {
118
118
spec := & features.Spec {
119
119
Directory : "/" ,
120
120
}
121
- directive , err := spec .Compile ("test" , "containerUser" , "remoteUser" , true , nil )
121
+ fromDirective , runDirective , err := spec .Compile ("test" , "containerUser" , "remoteUser" , true , nil )
122
122
require .NoError (t , err )
123
- require .Equal (t , "WORKDIR /envbuilder-features/test\n RUN --mount=type=bind,from=test,target=/envbuilder-features/test,rw _CONTAINER_USER=\" containerUser\" _REMOTE_USER=\" remoteUser\" ./install.sh" , strings .TrimSpace (directive ))
123
+ require .Equal (t , "FROM scratch AS envbuilder_feature_test\n COPY --from=test / /" , strings .TrimSpace (fromDirective ))
124
+ require .Equal (t , "WORKDIR /envbuilder-features/test\n RUN --mount=type=bind,from=envbuilder_feature_test,target=/envbuilder-features/test,rw _CONTAINER_USER=\" containerUser\" _REMOTE_USER=\" remoteUser\" ./install.sh" , strings .TrimSpace (runDirective ))
124
125
})
125
126
}
0 commit comments