@@ -105,7 +105,7 @@ func setup(
105
105
106
106
if dataClient != nil {
107
107
// these flags are only relevant when testing a dataClient
108
- flags .String (dataFlagDestination , utils .ResolveFile ("" ), "" )
108
+ flags .String (generalFlagDestination , utils .ResolveFile ("" ), "" )
109
109
}
110
110
111
111
cCtx := cli .NewContext (NewApp (out , errOut ), flags , nil )
@@ -788,7 +788,7 @@ func TestGetRobotPartLogs(t *testing.T) {
788
788
}
789
789
})
790
790
t .Run ("max count" , func (t * testing.T ) {
791
- flags := map [string ]any {logsFlagCount : maxNumLogs }
791
+ flags := map [string ]any {generalFlagCount : maxNumLogs }
792
792
cCtx , ac , out , errOut := setup (asc , nil , nil , nil , flags , "" )
793
793
794
794
test .That (t , ac .robotsPartLogsAction (cCtx , parseStructFromCtx [robotsPartLogsArgs ](cCtx )), test .ShouldBeNil )
@@ -889,29 +889,29 @@ func TestShellFileCopy(t *testing.T) {
889
889
t .Run ("no arguments or files" , func (t * testing.T ) {
890
890
cCtx , viamClient , _ , _ := setup (asc , nil , nil , nil , partFlags , "token" )
891
891
test .That (t ,
892
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
892
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
893
893
test .ShouldEqual , errNoFiles )
894
894
})
895
895
896
896
t .Run ("one file path is insufficient" , func (t * testing.T ) {
897
897
args := []string {"machine:path" }
898
898
cCtx , viamClient , _ , _ := setup (asc , nil , nil , nil , partFlags , "token" , args ... )
899
899
test .That (t ,
900
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
900
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
901
901
test .ShouldEqual , errLastArgOfFromMissing )
902
902
903
903
args = []string {"path" }
904
904
cCtx , viamClient , _ , _ = setup (asc , nil , nil , nil , partFlags , "token" , args ... )
905
905
test .That (t ,
906
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
906
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
907
907
test .ShouldEqual , errLastArgOfToMissing )
908
908
})
909
909
910
910
t .Run ("from has wrong path prefixes" , func (t * testing.T ) {
911
911
args := []string {"machine:path" , "path2" , "machine:path3" , "destination" }
912
912
cCtx , viamClient , _ , _ := setup (asc , nil , nil , nil , partFlags , "token" , args ... )
913
913
test .That (t ,
914
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
914
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
915
915
test .ShouldHaveSameTypeAs , copyFromPathInvalidError {})
916
916
})
917
917
@@ -925,7 +925,7 @@ func TestShellFileCopy(t *testing.T) {
925
925
cCtx , viamClient , _ , _ := setupWithRunningPart (
926
926
t , asc , nil , nil , partFlags , "token" , partFqdn , args ... )
927
927
test .That (t ,
928
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
928
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
929
929
test .ShouldBeNil )
930
930
931
931
rd , err := os .ReadFile (filepath .Join (tempDir , filepath .Base (tfs .SingleFileNested )))
@@ -944,7 +944,7 @@ func TestShellFileCopy(t *testing.T) {
944
944
cCtx , viamClient , _ , _ := setupWithRunningPart (
945
945
t , asc , nil , nil , partFlags , "token" , partFqdn , args ... )
946
946
test .That (t ,
947
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
947
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
948
948
test .ShouldBeNil )
949
949
950
950
rd , err := os .ReadFile (filepath .Join (tempDir , "foo" ))
@@ -960,7 +960,7 @@ func TestShellFileCopy(t *testing.T) {
960
960
t .Log ("without recursion set" )
961
961
cCtx , viamClient , _ , _ := setupWithRunningPart (
962
962
t , asc , nil , nil , partFlags , "token" , partFqdn , args ... )
963
- err := machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger )
963
+ err := viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger )
964
964
test .That (t , errors .Is (err , errDirectoryCopyRequestNoRecursion ), test .ShouldBeTrue )
965
965
_ , err = os .ReadFile (filepath .Join (tempDir , filepath .Base (tfs .SingleFileNested )))
966
966
test .That (t , errors .Is (err , fs .ErrNotExist ), test .ShouldBeTrue )
@@ -972,7 +972,7 @@ func TestShellFileCopy(t *testing.T) {
972
972
cCtx , viamClient , _ , _ = setupWithRunningPart (
973
973
t , asc , nil , nil , partFlagsCopy , "token" , partFqdn , args ... )
974
974
test .That (t ,
975
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
975
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
976
976
test .ShouldBeNil )
977
977
test .That (t , shelltestutils .DirectoryContentsEqual (tfs .Root , filepath .Join (tempDir , filepath .Base (tfs .Root ))), test .ShouldBeNil )
978
978
})
@@ -991,7 +991,7 @@ func TestShellFileCopy(t *testing.T) {
991
991
cCtx , viamClient , _ , _ := setupWithRunningPart (
992
992
t , asc , nil , nil , partFlagsCopy , "token" , partFqdn , args ... )
993
993
test .That (t ,
994
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
994
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
995
995
test .ShouldBeNil )
996
996
997
997
rd , err := os .ReadFile (filepath .Join (tempDir , filepath .Base (tfs .SingleFileNested )))
@@ -1027,7 +1027,7 @@ func TestShellFileCopy(t *testing.T) {
1027
1027
cCtx , viamClient , _ , _ := setupWithRunningPart (
1028
1028
t , asc , nil , nil , partFlagsCopy , "token" , partFqdn , args ... )
1029
1029
test .That (t ,
1030
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1030
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1031
1031
test .ShouldBeNil )
1032
1032
test .That (t , shelltestutils .DirectoryContentsEqual (tfs .Root , filepath .Join (tempDir , filepath .Base (tfs .Root ))), test .ShouldBeNil )
1033
1033
@@ -1055,7 +1055,7 @@ func TestShellFileCopy(t *testing.T) {
1055
1055
cCtx , viamClient , _ , _ := setupWithRunningPart (
1056
1056
t , asc , nil , nil , partFlags , "token" , partFqdn , args ... )
1057
1057
test .That (t ,
1058
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1058
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1059
1059
test .ShouldBeNil )
1060
1060
1061
1061
rd , err := os .ReadFile (filepath .Join (tempDir , filepath .Base (tfs .SingleFileNested )))
@@ -1073,7 +1073,7 @@ func TestShellFileCopy(t *testing.T) {
1073
1073
cCtx , viamClient , _ , _ := setupWithRunningPart (
1074
1074
t , asc , nil , nil , partFlags , "token" , partFqdn , args ... )
1075
1075
test .That (t ,
1076
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1076
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1077
1077
test .ShouldBeNil )
1078
1078
1079
1079
rd , err := os .ReadFile (randomPath )
@@ -1089,7 +1089,7 @@ func TestShellFileCopy(t *testing.T) {
1089
1089
t .Log ("without recursion set" )
1090
1090
cCtx , viamClient , _ , _ := setupWithRunningPart (
1091
1091
t , asc , nil , nil , partFlags , "token" , partFqdn , args ... )
1092
- err := machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger )
1092
+ err := viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger )
1093
1093
test .That (t , errors .Is (err , errDirectoryCopyRequestNoRecursion ), test .ShouldBeTrue )
1094
1094
_ , err = os .ReadFile (filepath .Join (tempDir , filepath .Base (tfs .SingleFileNested )))
1095
1095
test .That (t , errors .Is (err , fs .ErrNotExist ), test .ShouldBeTrue )
@@ -1101,7 +1101,7 @@ func TestShellFileCopy(t *testing.T) {
1101
1101
cCtx , viamClient , _ , _ = setupWithRunningPart (
1102
1102
t , asc , nil , nil , partFlagsCopy , "token" , partFqdn , args ... )
1103
1103
test .That (t ,
1104
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1104
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1105
1105
test .ShouldBeNil )
1106
1106
test .That (t , shelltestutils .DirectoryContentsEqual (tfs .Root , filepath .Join (tempDir , filepath .Base (tfs .Root ))), test .ShouldBeNil )
1107
1107
})
@@ -1120,7 +1120,7 @@ func TestShellFileCopy(t *testing.T) {
1120
1120
cCtx , viamClient , _ , _ := setupWithRunningPart (
1121
1121
t , asc , nil , nil , partFlagsCopy , "token" , partFqdn , args ... )
1122
1122
test .That (t ,
1123
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1123
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1124
1124
test .ShouldBeNil )
1125
1125
1126
1126
rd , err := os .ReadFile (filepath .Join (tempDir , filepath .Base (tfs .SingleFileNested )))
@@ -1156,7 +1156,7 @@ func TestShellFileCopy(t *testing.T) {
1156
1156
cCtx , viamClient , _ , _ := setupWithRunningPart (
1157
1157
t , asc , nil , nil , partFlagsCopy , "token" , partFqdn , args ... )
1158
1158
test .That (t ,
1159
- machinesPartCopyFilesAction (cCtx , viamClient , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1159
+ viamClient . machinesPartCopyFilesAction (cCtx , parseStructFromCtx [machinesPartCopyFilesArgs ](cCtx ), logger ),
1160
1160
test .ShouldBeNil )
1161
1161
test .That (t , shelltestutils .DirectoryContentsEqual (tfs .Root , filepath .Join (tempDir , filepath .Base (tfs .Root ))), test .ShouldBeNil )
1162
1162
0 commit comments