@@ -35,7 +35,7 @@ import (
35
35
const (
36
36
testTempDirPrefix = "init-docker-test-"
37
37
38
- expectedAgentBindsUnspecifiedPlatform = 21
38
+ expectedAgentBindsUnspecifiedPlatform = 20
39
39
expectedAgentBindsSuseUbuntuPlatform = 18
40
40
)
41
41
@@ -829,21 +829,13 @@ func TestStartAgentWithExecBinds(t *testing.T) {
829
829
hostCapabilityExecResourcesDir := filepath .Join (hostResourcesRootDir , execCapabilityName )
830
830
containerCapabilityExecResourcesDir := filepath .Join (containerResourcesRootDir , execCapabilityName )
831
831
832
- // binaries
833
- hostBinDir := filepath .Join (hostCapabilityExecResourcesDir , execBinRelativePath )
834
- containerBinDir := filepath .Join (containerCapabilityExecResourcesDir , execBinRelativePath )
835
-
836
832
// config
837
833
hostConfigDir := filepath .Join (hostCapabilityExecResourcesDir , execConfigRelativePath )
838
834
containerConfigDir := filepath .Join (containerCapabilityExecResourcesDir , execConfigRelativePath )
839
835
840
- // certs
841
- hostCertsDir := filepath .Join (hostCapabilityExecResourcesDir , execCertsRelativePath )
842
- containerCertsDir := filepath .Join (containerCapabilityExecResourcesDir , execCertsRelativePath )
843
-
844
836
expectedExecBinds := []string {
845
- hostBinDir + ":" + containerBinDir + readOnly ,
846
- hostCertsDir + ":" + containerCertsDir + readOnly ,
837
+ hostResourcesRootDir + ":" + containerResourcesRootDir + readOnly ,
838
+ hostConfigDir + ":" + containerConfigDir ,
847
839
}
848
840
expectedAgentBinds += len (expectedExecBinds )
849
841
@@ -886,18 +878,10 @@ func TestGetCapabilityExecBinds(t *testing.T) {
886
878
hostCapabilityExecResourcesDir := filepath .Join (hostResourcesRootDir , execCapabilityName )
887
879
containerCapabilityExecResourcesDir := filepath .Join (containerResourcesRootDir , execCapabilityName )
888
880
889
- // binaries
890
- hostBinDir := filepath .Join (hostCapabilityExecResourcesDir , execBinRelativePath )
891
- containerBinDir := filepath .Join (containerCapabilityExecResourcesDir , execBinRelativePath )
892
-
893
881
// config
894
882
hostConfigDir := filepath .Join (hostCapabilityExecResourcesDir , execConfigRelativePath )
895
883
containerConfigDir := filepath .Join (containerCapabilityExecResourcesDir , execConfigRelativePath )
896
884
897
- // certs
898
- hostCertsDir := filepath .Join (hostCapabilityExecResourcesDir , execCertsRelativePath )
899
- containerCertsDir := filepath .Join (containerCapabilityExecResourcesDir , execCertsRelativePath )
900
-
901
885
testCases := []struct {
902
886
name string
903
887
testIsPathValid func (string , bool ) bool
@@ -909,35 +893,31 @@ func TestGetCapabilityExecBinds(t *testing.T) {
909
893
return true
910
894
},
911
895
expectedBinds : []string {
912
- hostBinDir + ":" + containerBinDir + readOnly ,
896
+ hostResourcesRootDir + ":" + containerResourcesRootDir + readOnly ,
913
897
hostConfigDir + ":" + containerConfigDir ,
914
- hostCertsDir + ":" + containerCertsDir + readOnly ,
915
898
},
916
899
},
917
900
{
918
- name : "only ssm-agent bin path valid" ,
901
+ name : "managed-agents path valid, no execute-command " ,
919
902
testIsPathValid : func (path string , isDir bool ) bool {
920
- return path == hostBinDir
903
+ return path == hostResourcesRootDir
921
904
},
922
905
expectedBinds : []string {
923
- hostBinDir + ":" + containerBinDir + readOnly ,
924
- hostConfigDir + ":" + containerConfigDir ,
906
+ hostResourcesRootDir + ":" + containerResourcesRootDir + readOnly ,
925
907
},
926
908
},
927
909
{
928
910
name : "no path valid" ,
929
911
testIsPathValid : func (path string , isDir bool ) bool {
930
912
return false
931
913
},
932
- expectedBinds : []string {
933
- hostConfigDir + ":" + containerConfigDir ,
934
- },
914
+ expectedBinds : []string {},
935
915
},
936
916
}
937
917
for _ , tc := range testCases {
938
918
t .Run (tc .name , func (t * testing.T ) {
939
919
isPathValid = tc .testIsPathValid
940
- binds := getCapabilityExecBinds ()
920
+ binds := getCapabilityBinds ()
941
921
assert .Equal (t , tc .expectedBinds , binds )
942
922
})
943
923
}
0 commit comments