File tree Expand file tree Collapse file tree 7 files changed +70
-1
lines changed Expand file tree Collapse file tree 7 files changed +70
-1
lines changed Original file line number Diff line number Diff line change 5656        run : sudo apt update && sudo apt install just 
5757      - uses : actions/checkout@v4 
5858      - name : Build and run container integration tests 
59-         run : sudo just run-container-integration 
59+         run : sudo just run-container-integration run-container-external-tests  
6060  cargo-deny :
6161    runs-on : ubuntu-latest 
6262    steps :
Original file line number Diff line number Diff line change @@ -10,5 +10,9 @@ build-integration-test-image *ARGS: build
1010run-container-integration :  build-integration-test-image 
1111    podman run --rm localhost/ bootc-integration bootc-integration-tests container
1212
13+ # These tests may spawn their own container images. 
14+ run-container-external-tests : 
15+    ./ tests/ container/ run localhost/ bootc
16+ 
1317unittest  * ARGS : 
1418    podman build --jobs=4  --target units -t localhost/ bootc-units --build-arg=unitargs={{ ARGS}}   .
Original file line number Diff line number Diff line change @@ -472,6 +472,9 @@ pub(crate) enum InternalsOpts {
472472        // The stateroot 
473473        stateroot :  String , 
474474    } , 
475+     /// Initiate a reboot the same way we would after --apply; intended 
476+      /// primarily for testing. 
477+      Reboot , 
475478    #[ cfg( feature = "rhsm" ) ]  
476479    /// Publish subscription-manager facts to /etc/rhsm/facts/bootc.facts 
477480     PublishRhsmFacts , 
@@ -1230,6 +1233,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
12301233                    Ok ( ( ) ) 
12311234                } 
12321235            } , 
1236+             InternalsOpts :: Reboot  => crate :: reboot:: reboot ( ) , 
12331237            InternalsOpts :: Fsck  => { 
12341238                let  sysroot = & get_storage ( ) . await ?; 
12351239                crate :: fsck:: fsck ( & sysroot,  std:: io:: stdout ( ) . lock ( ) ) . await ?; 
Original file line number Diff line number Diff line change 1+ [Unit] 
2+ ConditionPathExists =!/etc/initrd-release 
3+ After =local-fs.target
4+ RequiresMountsFor =/run/bootc-test-reboot
5+ Before =bootc-test-reboot.service
6+ PartOf =bootc-test-reboot.service
7+ 
8+ [Service] 
9+ Type =oneshot
10+ RemainAfterExit =yes
11+ ExecStop =touch /run/bootc-test-reboot/success
Original file line number Diff line number Diff line change 1+ [Unit] 
2+ ConditionPathExists =!/etc/initrd-release 
3+ Requires =bootc-finish-test-reboot.service
4+ After =bootc-finish-test-reboot.service
5+ 
6+ [Service] 
7+ Type =oneshot
8+ RemainAfterExit =yes
9+ ExecStart =bootc internals reboot
10+ 
11+ [Install] 
12+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #  Verify that invoking `bootc internals reboot` actually invokes a reboot, when
3+ #  running inside systemd.
4+ #  xref:
5+ #  - https://github.com/bootc-dev/bootc/issues/1416
6+ #  - https://github.com/bootc-dev/bootc/issues/1419
7+ set  -euo pipefail
8+ image=$1 
9+ tmpd=$( mktemp -d) 
10+ log () {
11+   echo  " $@ " 
12+   " $@ " 
13+ }
14+ log timeout 120 podman run --rm --systemd=always --privileged -v /sys:/sys:ro --label bootc.test=reboot --net=none -v $( pwd)  :/src:ro -v $tmpd :/run/bootc-test-reboot $image  /bin/sh -c ' cp /src/*.service /etc/systemd/system && systemctl enable bootc-test-reboot && exec /sbin/init'   ||  true 
15+ ls -al $tmpd 
16+ if  test  ' !'   -f $tmpd /success;  then 
17+   echo  " reboot failed"   1>&2 
18+   rm -rf " $tmpd " 
19+   exit  1
20+ fi 
21+ rm -rf " $tmpd " 
22+ echo  " ok reboot" 
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set  -euo pipefail
3+ image=$1 
4+ shift 
5+ 
6+ cd  $( dirname $0 ) 
7+ 
8+ tests=$( find .  -maxdepth 1 -type d) 
9+ for  case  in  $tests ;  do 
10+   if  test  $case  = . ;  then  continue ;  fi 
11+   echo  " Running: $case " 
12+   cd  $case 
13+   ./run $image 
14+   cd  -
15+   echo  " ok $case " 
16+ done 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments