@@ -225,13 +225,12 @@ impl TestContext {
225225 async move {
226226 let deployment = api. get ( & name) . await ?;
227227
228- if let Some ( status) = & deployment. status {
229- if let Some ( available_replicas) = status. available_replicas {
230- if available_replicas == 1 {
231- test_info ! ( & tn, "{} deployment has 1 available replica" , name) ;
232- return Ok ( ( ) ) ;
233- }
234- }
228+ if let Some ( status) = & deployment. status
229+ && let Some ( available_replicas) = status. available_replicas
230+ && available_replicas == 1
231+ {
232+ test_info ! ( & tn, "{} deployment has 1 available replica" , name) ;
233+ return Ok ( ( ) ) ;
235234 }
236235
237236 Err ( anyhow:: anyhow!(
@@ -357,40 +356,40 @@ impl TestContext {
357356
358357 let sa_src = workspace_root. join ( "config/rbac/service_account.yaml" ) ;
359358 let sa_content = std:: fs:: read_to_string ( & sa_src) ?
360- . replace ( "namespace: system" , & format ! ( "namespace: {}" , ns ) ) ;
359+ . replace ( "namespace: system" , & format ! ( "namespace: {ns}" ) ) ;
361360 let sa_dst = rbac_temp_dir. join ( "service_account.yaml" ) ;
362361 std:: fs:: write ( & sa_dst, sa_content) ?;
363362
364363 let role_path = rbac_temp_dir. join ( "role.yaml" ) ;
365364 let role_content = std:: fs:: read_to_string ( & role_path) ?. replace (
366365 "name: trusted-cluster-operator-role" ,
367- & format ! ( "name: {}-trusted-cluster-operator-role" , ns ) ,
366+ & format ! ( "name: {ns }-trusted-cluster-operator-role" ) ,
368367 ) ;
369368 std:: fs:: write ( & role_path, role_content) ?;
370369
371370 let rb_src = workspace_root. join ( "config/rbac/role_binding.yaml" ) ;
372371 let rb_content = std:: fs:: read_to_string ( & rb_src) ?
373372 . replace (
374373 "name: manager-rolebinding" ,
375- & format ! ( "name: {}-manager-rolebinding" , ns ) ,
374+ & format ! ( "name: {ns }-manager-rolebinding" ) ,
376375 )
377376 . replace (
378377 "name: trusted-cluster-operator-role" ,
379- & format ! ( "name: {}-trusted-cluster-operator-role" , ns ) ,
378+ & format ! ( "name: {ns }-trusted-cluster-operator-role" ) ,
380379 )
381- . replace ( "namespace: system" , & format ! ( "namespace: {}" , ns ) ) ;
380+ . replace ( "namespace: system" , & format ! ( "namespace: {ns}" ) ) ;
382381 let rb_dst = rbac_temp_dir. join ( "role_binding.yaml" ) ;
383382 std:: fs:: write ( & rb_dst, rb_content) ?;
384383
385384 let le_role_src = workspace_root. join ( "config/rbac/leader_election_role.yaml" ) ;
386385 let le_role_content = std:: fs:: read_to_string ( & le_role_src) ?
387- . replace ( "namespace: system" , & format ! ( "namespace: {}" , ns ) ) ;
386+ . replace ( "namespace: system" , & format ! ( "namespace: {ns}" ) ) ;
388387 let le_role_dst = rbac_temp_dir. join ( "leader_election_role.yaml" ) ;
389388 std:: fs:: write ( & le_role_dst, le_role_content) ?;
390389
391390 let le_rb_src = workspace_root. join ( "config/rbac/leader_election_role_binding.yaml" ) ;
392391 let le_rb_content = std:: fs:: read_to_string ( & le_rb_src) ?
393- . replace ( "namespace: system" , & format ! ( "namespace: {}" , ns ) ) ;
392+ . replace ( "namespace: system" , & format ! ( "namespace: {ns}" ) ) ;
394393 let le_rb_dst = rbac_temp_dir. join ( "leader_election_role_binding.yaml" ) ;
395394 std:: fs:: write ( & le_rb_dst, le_rb_content) ?;
396395
@@ -399,16 +398,15 @@ impl TestContext {
399398 r#"# SPDX-FileCopyrightText: Generated for testing
400399# SPDX-License-Identifier: CC0-1.0
401400
402- namespace: {}
401+ namespace: {ns }
403402
404403resources:
405404 - service_account.yaml
406405 - role.yaml
407406 - role_binding.yaml
408407 - leader_election_role.yaml
409408 - leader_election_role_binding.yaml
410- "# ,
411- ns
409+ "#
412410 ) ;
413411
414412 let temp_kustomization_path = rbac_temp_dir. join ( "kustomization.yaml" ) ;
@@ -436,19 +434,19 @@ resources:
436434 & self . test_name,
437435 "Updating CR manifest with publicTrusteeAddr"
438436 ) ;
439- let trustee_addr = format ! ( "kbs-service.{}.svc.cluster.local:8080" , ns ) ;
437+ let trustee_addr = format ! ( "kbs-service.{ns }.svc.cluster.local:8080" ) ;
440438 let cr_manifest_path = manifests_path. join ( "trusted_execution_cluster_cr.yaml" ) ;
441439
442440 let cr_content = std:: fs:: read_to_string ( & cr_manifest_path) ?;
443441 let mut cr_value: serde_yaml:: Value = serde_yaml:: from_str ( & cr_content) ?;
444442
445- if let Some ( spec) = cr_value. get_mut ( "spec" ) {
446- if let Some ( spec_map) = spec. as_mapping_mut ( ) {
447- spec_map . insert (
448- serde_yaml :: Value :: String ( "publicTrusteeAddr" . to_string ( ) ) ,
449- serde_yaml:: Value :: String ( trustee_addr . clone ( ) ) ,
450- ) ;
451- }
443+ if let Some ( spec) = cr_value. get_mut ( "spec" )
444+ && let Some ( spec_map) = spec. as_mapping_mut ( )
445+ {
446+ spec_map . insert (
447+ serde_yaml:: Value :: String ( "publicTrusteeAddr" . to_string ( ) ) ,
448+ serde_yaml :: Value :: String ( trustee_addr . clone ( ) ) ,
449+ ) ;
452450 }
453451
454452 let updated_content = serde_yaml:: to_string ( & cr_value) ?;
@@ -494,8 +492,7 @@ resources:
494492 . with_timeout ( Duration :: from_secs ( 60 ) )
495493 . with_interval ( Duration :: from_secs ( 5 ) )
496494 . with_error_message ( format ! (
497- "image-pcrs ConfigMap in the namespace {} not found" ,
498- ns
495+ "image-pcrs ConfigMap in the namespace {ns} not found"
499496 ) ) ;
500497
501498 let test_name_owned = self . test_name . clone ( ) ;
0 commit comments