@@ -82,15 +82,15 @@ pub trait TestDsl {
82
82
async fn get_worker_metadata (
83
83
& self ,
84
84
worker_id : & WorkerId ,
85
- ) -> crate :: Result < Option < WorkerMetadata > > ;
85
+ ) -> crate :: Result < Option < ( WorkerMetadata , Option < String > ) > > ;
86
86
async fn get_workers_metadata (
87
87
& self ,
88
88
component_id : & ComponentId ,
89
89
filter : Option < WorkerFilter > ,
90
90
cursor : ScanCursor ,
91
91
count : u64 ,
92
92
precise : bool ,
93
- ) -> crate :: Result < ( Option < ScanCursor > , Vec < WorkerMetadata > ) > ;
93
+ ) -> crate :: Result < ( Option < ScanCursor > , Vec < ( WorkerMetadata , Option < String > ) > ) > ;
94
94
async fn delete_worker ( & self , worker_id : & WorkerId ) -> crate :: Result < ( ) > ;
95
95
96
96
async fn invoke (
@@ -283,7 +283,7 @@ impl<T: TestDependencies + Send + Sync> TestDsl for T {
283
283
async fn get_worker_metadata (
284
284
& self ,
285
285
worker_id : & WorkerId ,
286
- ) -> crate :: Result < Option < WorkerMetadata > > {
286
+ ) -> crate :: Result < Option < ( WorkerMetadata , Option < String > ) > > {
287
287
let worker_id: golem_api_grpc:: proto:: golem:: worker:: WorkerId = worker_id. clone ( ) . into ( ) ;
288
288
let response = self
289
289
. worker_service ( )
@@ -319,7 +319,7 @@ impl<T: TestDependencies + Send + Sync> TestDsl for T {
319
319
cursor : ScanCursor ,
320
320
count : u64 ,
321
321
precise : bool ,
322
- ) -> crate :: Result < ( Option < ScanCursor > , Vec < WorkerMetadata > ) > {
322
+ ) -> crate :: Result < ( Option < ScanCursor > , Vec < ( WorkerMetadata , Option < String > ) > ) > {
323
323
let component_id: golem_api_grpc:: proto:: golem:: component:: ComponentId =
324
324
component_id. clone ( ) . into ( ) ;
325
325
let response = self
@@ -945,117 +945,120 @@ pub fn worker_error_message(error: &Error) -> String {
945
945
946
946
pub fn to_worker_metadata (
947
947
metadata : & golem_api_grpc:: proto:: golem:: worker:: WorkerMetadata ,
948
- ) -> WorkerMetadata {
949
- WorkerMetadata {
950
- worker_id : metadata
951
- . worker_id
952
- . clone ( )
953
- . expect ( "no worker_id" )
954
- . clone ( )
955
- . try_into ( )
956
- . expect ( "invalid worker_id" ) ,
957
- args : metadata. args . clone ( ) ,
958
- env : metadata
959
- . env
960
- . iter ( )
961
- . map ( |( k, v) | ( k. clone ( ) , v. clone ( ) ) )
962
- . collect :: < Vec < _ > > ( ) ,
963
- account_id : metadata
964
- . account_id
965
- . clone ( )
966
- . expect ( "no account_id" )
967
- . clone ( )
968
- . into ( ) ,
969
- created_at : metadata
970
- . created_at
971
- . as_ref ( )
972
- . expect ( "no created_at" )
973
- . clone ( )
974
- . into ( ) ,
975
- last_known_status : WorkerStatusRecord {
976
- oplog_idx : OplogIndex :: default ( ) ,
977
- status : metadata. status . try_into ( ) . expect ( "invalid status" ) ,
978
- overridden_retry_config : None , // not passed through gRPC
979
- deleted_regions : DeletedRegions :: new ( ) ,
980
- pending_invocations : vec ! [ ] ,
981
- pending_updates : metadata
982
- . updates
948
+ ) -> ( WorkerMetadata , Option < String > ) {
949
+ (
950
+ WorkerMetadata {
951
+ worker_id : metadata
952
+ . worker_id
953
+ . clone ( )
954
+ . expect ( "no worker_id" )
955
+ . clone ( )
956
+ . try_into ( )
957
+ . expect ( "invalid worker_id" ) ,
958
+ args : metadata. args . clone ( ) ,
959
+ env : metadata
960
+ . env
983
961
. iter ( )
984
- . filter_map ( |u| match & u. update {
985
- Some ( Update :: Pending ( _) ) => Some ( TimestampedUpdateDescription {
986
- timestamp : u
987
- . timestamp
988
- . as_ref ( )
989
- . expect ( "no timestamp on update record" )
990
- . clone ( )
991
- . into ( ) ,
992
- oplog_index : OplogIndex :: from_u64 ( 0 ) ,
993
- description : UpdateDescription :: Automatic {
962
+ . map ( |( k, v) | ( k. clone ( ) , v. clone ( ) ) )
963
+ . collect :: < Vec < _ > > ( ) ,
964
+ account_id : metadata
965
+ . account_id
966
+ . clone ( )
967
+ . expect ( "no account_id" )
968
+ . clone ( )
969
+ . into ( ) ,
970
+ created_at : metadata
971
+ . created_at
972
+ . as_ref ( )
973
+ . expect ( "no created_at" )
974
+ . clone ( )
975
+ . into ( ) ,
976
+ last_known_status : WorkerStatusRecord {
977
+ oplog_idx : OplogIndex :: default ( ) ,
978
+ status : metadata. status . try_into ( ) . expect ( "invalid status" ) ,
979
+ overridden_retry_config : None , // not passed through gRPC
980
+ deleted_regions : DeletedRegions :: new ( ) ,
981
+ pending_invocations : vec ! [ ] ,
982
+ pending_updates : metadata
983
+ . updates
984
+ . iter ( )
985
+ . filter_map ( |u| match & u. update {
986
+ Some ( Update :: Pending ( _) ) => Some ( TimestampedUpdateDescription {
987
+ timestamp : u
988
+ . timestamp
989
+ . as_ref ( )
990
+ . expect ( "no timestamp on update record" )
991
+ . clone ( )
992
+ . into ( ) ,
993
+ oplog_index : OplogIndex :: from_u64 ( 0 ) ,
994
+ description : UpdateDescription :: Automatic {
995
+ target_version : u. target_version ,
996
+ } ,
997
+ } ) ,
998
+ _ => None ,
999
+ } )
1000
+ . collect ( ) ,
1001
+ failed_updates : metadata
1002
+ . updates
1003
+ . iter ( )
1004
+ . filter_map ( |u| match & u. update {
1005
+ Some ( Update :: Failed ( failed_update) ) => Some ( FailedUpdateRecord {
1006
+ timestamp : u
1007
+ . timestamp
1008
+ . as_ref ( )
1009
+ . expect ( "no timestamp on update record" )
1010
+ . clone ( )
1011
+ . into ( ) ,
994
1012
target_version : u. target_version ,
995
- } ,
996
- } ) ,
997
- _ => None ,
998
- } )
999
- . collect ( ) ,
1000
- failed_updates : metadata
1001
- . updates
1002
- . iter ( )
1003
- . filter_map ( |u| match & u. update {
1004
- Some ( Update :: Failed ( failed_update) ) => Some ( FailedUpdateRecord {
1005
- timestamp : u
1006
- . timestamp
1007
- . as_ref ( )
1008
- . expect ( "no timestamp on update record" )
1009
- . clone ( )
1010
- . into ( ) ,
1011
- target_version : u. target_version ,
1012
- details : failed_update. details . clone ( ) ,
1013
- } ) ,
1014
- _ => None ,
1015
- } )
1016
- . collect ( ) ,
1017
- successful_updates : metadata
1018
- . updates
1019
- . iter ( )
1020
- . filter_map ( |u| match & u. update {
1021
- Some ( Update :: Successful ( _) ) => Some ( SuccessfulUpdateRecord {
1022
- timestamp : u
1023
- . timestamp
1024
- . as_ref ( )
1025
- . expect ( "no timestamp on update record" )
1026
- . clone ( )
1027
- . into ( ) ,
1028
- target_version : u. target_version ,
1029
- } ) ,
1030
- _ => None ,
1031
- } )
1032
- . collect ( ) ,
1033
- invocation_results : HashMap :: new ( ) ,
1034
- current_idempotency_key : None ,
1035
- component_version : metadata. component_version ,
1036
- component_size : metadata. component_size ,
1037
- total_linear_memory_size : metadata. total_linear_memory_size ,
1038
- owned_resources : metadata
1039
- . owned_resources
1040
- . iter ( )
1041
- . map ( |( k, v) | {
1042
- (
1043
- WorkerResourceId ( * k) ,
1044
- WorkerResourceDescription {
1045
- created_at : v
1046
- . created_at
1013
+ details : failed_update. details . clone ( ) ,
1014
+ } ) ,
1015
+ _ => None ,
1016
+ } )
1017
+ . collect ( ) ,
1018
+ successful_updates : metadata
1019
+ . updates
1020
+ . iter ( )
1021
+ . filter_map ( |u| match & u. update {
1022
+ Some ( Update :: Successful ( _) ) => Some ( SuccessfulUpdateRecord {
1023
+ timestamp : u
1024
+ . timestamp
1047
1025
. as_ref ( )
1048
- . expect ( "no timestamp on resource metadata " )
1026
+ . expect ( "no timestamp on update record " )
1049
1027
. clone ( )
1050
1028
. into ( ) ,
1051
- indexed_resource_key : v. indexed . clone ( ) . map ( |i| i. into ( ) ) ,
1052
- } ,
1053
- )
1054
- } )
1055
- . collect ( ) ,
1029
+ target_version : u. target_version ,
1030
+ } ) ,
1031
+ _ => None ,
1032
+ } )
1033
+ . collect ( ) ,
1034
+ invocation_results : HashMap :: new ( ) ,
1035
+ current_idempotency_key : None ,
1036
+ component_version : metadata. component_version ,
1037
+ component_size : metadata. component_size ,
1038
+ total_linear_memory_size : metadata. total_linear_memory_size ,
1039
+ owned_resources : metadata
1040
+ . owned_resources
1041
+ . iter ( )
1042
+ . map ( |( k, v) | {
1043
+ (
1044
+ WorkerResourceId ( * k) ,
1045
+ WorkerResourceDescription {
1046
+ created_at : v
1047
+ . created_at
1048
+ . as_ref ( )
1049
+ . expect ( "no timestamp on resource metadata" )
1050
+ . clone ( )
1051
+ . into ( ) ,
1052
+ indexed_resource_key : v. indexed . clone ( ) . map ( |i| i. into ( ) ) ,
1053
+ } ,
1054
+ )
1055
+ } )
1056
+ . collect ( ) ,
1057
+ } ,
1058
+ parent : None ,
1056
1059
} ,
1057
- parent : None ,
1058
- }
1060
+ metadata . last_error . clone ( ) ,
1061
+ )
1059
1062
}
1060
1063
1061
1064
fn dump_component_info ( path : & Path ) -> golem_common:: model:: component_metadata:: ComponentMetadata {
@@ -1121,15 +1124,18 @@ pub trait TestDslUnsafe {
1121
1124
args : Vec < String > ,
1122
1125
env : HashMap < String , String > ,
1123
1126
) -> Result < WorkerId , Error > ;
1124
- async fn get_worker_metadata ( & self , worker_id : & WorkerId ) -> Option < WorkerMetadata > ;
1127
+ async fn get_worker_metadata (
1128
+ & self ,
1129
+ worker_id : & WorkerId ,
1130
+ ) -> Option < ( WorkerMetadata , Option < String > ) > ;
1125
1131
async fn get_workers_metadata (
1126
1132
& self ,
1127
1133
component_id : & ComponentId ,
1128
1134
filter : Option < WorkerFilter > ,
1129
1135
cursor : ScanCursor ,
1130
1136
count : u64 ,
1131
1137
precise : bool ,
1132
- ) -> ( Option < ScanCursor > , Vec < WorkerMetadata > ) ;
1138
+ ) -> ( Option < ScanCursor > , Vec < ( WorkerMetadata , Option < String > ) > ) ;
1133
1139
async fn delete_worker ( & self , worker_id : & WorkerId ) -> ( ) ;
1134
1140
1135
1141
async fn invoke (
@@ -1246,7 +1252,10 @@ impl<T: TestDsl + Sync> TestDslUnsafe for T {
1246
1252
. expect ( "Failed to start worker" )
1247
1253
}
1248
1254
1249
- async fn get_worker_metadata ( & self , worker_id : & WorkerId ) -> Option < WorkerMetadata > {
1255
+ async fn get_worker_metadata (
1256
+ & self ,
1257
+ worker_id : & WorkerId ,
1258
+ ) -> Option < ( WorkerMetadata , Option < String > ) > {
1250
1259
<T as TestDsl >:: get_worker_metadata ( self , worker_id)
1251
1260
. await
1252
1261
. expect ( "Failed to get worker metadata" )
@@ -1259,7 +1268,7 @@ impl<T: TestDsl + Sync> TestDslUnsafe for T {
1259
1268
cursor : ScanCursor ,
1260
1269
count : u64 ,
1261
1270
precise : bool ,
1262
- ) -> ( Option < ScanCursor > , Vec < WorkerMetadata > ) {
1271
+ ) -> ( Option < ScanCursor > , Vec < ( WorkerMetadata , Option < String > ) > ) {
1263
1272
<T as TestDsl >:: get_workers_metadata ( self , component_id, filter, cursor, count, precise)
1264
1273
. await
1265
1274
. expect ( "Failed to get workers metadata" )
0 commit comments