@@ -2,6 +2,7 @@ use std::path::Path;
2
2
use std:: { os:: fd:: AsRawFd , path:: PathBuf } ;
3
3
4
4
use anyhow:: Result ;
5
+ use camino:: Utf8Path ;
5
6
use cap_std_ext:: cap_std;
6
7
use cap_std_ext:: cap_std:: fs:: Dir ;
7
8
use fn_error_context:: context;
@@ -53,6 +54,12 @@ fn find_deployment_root() -> Result<Dir> {
53
54
anyhow:: bail!( "Failed to find deployment root" )
54
55
}
55
56
57
+ // Hook relatively cheap post-install tests here
58
+ fn generic_post_install_verification ( ) -> Result < ( ) > {
59
+ assert ! ( Utf8Path :: new( "/ostree/repo" ) . try_exists( ) ?) ;
60
+ Ok ( ( ) )
61
+ }
62
+
56
63
#[ context( "Install tests" ) ]
57
64
pub ( crate ) fn run_alongside ( image : & str , mut testargs : libtest_mimic:: Arguments ) -> Result < ( ) > {
58
65
// Force all of these tests to be serial because they mutate global state
@@ -88,6 +95,8 @@ pub(crate) fn run_alongside(image: &str, mut testargs: libtest_mimic::Arguments)
88
95
std
:: fs
:: write ( & tmp_keys
, b"ssh-ed25519 ABC0123 [email protected] " ) ?
;
89
96
cmd ! ( sh, "sudo {BASE_ARGS...} {target_args...} -v {tmp_keys}:/test_authorized_keys {image} bootc install to-filesystem {generic_inst_args...} --acknowledge-destructive --karg=foo=bar --replace=alongside --root-ssh-authorized-keys=/test_authorized_keys /target" ) . run ( ) ?;
90
97
98
+ generic_post_install_verification ( ) ?;
99
+
91
100
// Test kargs injected via CLI
92
101
cmd ! (
93
102
sh,
@@ -120,6 +129,7 @@ pub(crate) fn run_alongside(image: &str, mut testargs: libtest_mimic::Arguments)
120
129
let sh = & xshell:: Shell :: new ( ) ?;
121
130
reset_root ( sh) ?;
122
131
cmd ! ( sh, "sudo {BASE_ARGS...} {target_args...} {image} bootc install to-existing-root --acknowledge-destructive {generic_inst_args...}" ) . run ( ) ?;
132
+ generic_post_install_verification ( ) ?;
123
133
let root = & Dir :: open_ambient_dir ( "/ostree" , cap_std:: ambient_authority ( ) ) . unwrap ( ) ;
124
134
let mut path = PathBuf :: from ( "." ) ;
125
135
crate :: selinux:: verify_selinux_recurse ( root, & mut path, false ) ?;
@@ -131,6 +141,7 @@ pub(crate) fn run_alongside(image: &str, mut testargs: libtest_mimic::Arguments)
131
141
let empty = sh. create_temp_dir ( ) ?;
132
142
let empty = empty. path ( ) . to_str ( ) . unwrap ( ) ;
133
143
cmd ! ( sh, "sudo {BASE_ARGS...} {target_args...} -v {empty}:/usr/lib/bootc/install {image} bootc install to-existing-root {generic_inst_args...}" ) . run ( ) ?;
144
+ generic_post_install_verification ( ) ?;
134
145
Ok ( ( ) )
135
146
} ) ,
136
147
] ;
0 commit comments