@@ -452,6 +452,21 @@ mod tests {
452452 hash. trim ( ) . to_owned ( )
453453 }
454454
455+ fn make_stdenv_pr_repo ( bare : & Path , co : & Path ) -> String {
456+ let output = Command :: new ( "bash" )
457+ . current_dir ( tpath ( "./test-srcs" ) )
458+ . arg ( "make-stdenv-pr.sh" )
459+ . arg ( bare)
460+ . arg ( co)
461+ . stderr ( Stdio :: null ( ) )
462+ . stdout ( Stdio :: piped ( ) )
463+ . output ( )
464+ . expect ( "building the test PR failed" ) ;
465+ let hash = String :: from_utf8 ( output. stdout ) . expect ( "Should just be a hash" ) ;
466+
467+ hash. trim ( ) . to_owned ( )
468+ }
469+
455470 fn strip_escaped_ansi ( string : & str ) -> String {
456471 string
457472 . replace ( "‘" , "'" )
@@ -532,6 +547,45 @@ mod tests {
532547 assert_eq ! ( actions. next( ) , Some ( worker:: Action :: Ack ) ) ;
533548 }
534549
550+ #[ test]
551+ pub fn test_stdenv_rebuild ( ) {
552+ let p = TestScratch :: new_dir ( "build-stdenv-build-working" ) ;
553+ let bare_repo = TestScratch :: new_dir ( "build-stdenv-build-bare" ) ;
554+ let co_repo = TestScratch :: new_dir ( "build-stdenv-build-co" ) ;
555+
556+ let head_sha = make_stdenv_pr_repo ( & bare_repo. path ( ) , & co_repo. path ( ) ) ;
557+ let worker = make_worker ( & p. path ( ) ) ;
558+
559+ let job = buildjob:: BuildJob {
560+ attrs : vec ! [ "success" . to_owned( ) ] ,
561+ pr : Pr {
562+ head_sha,
563+ number : 1 ,
564+ target_branch : Some ( "staging" . to_owned ( ) ) ,
565+ } ,
566+ repo : Repo {
567+ clone_url : bare_repo. path ( ) . to_str ( ) . unwrap ( ) . to_owned ( ) ,
568+ full_name : "test-git" . to_owned ( ) ,
569+ name : "nixos" . to_owned ( ) ,
570+ owner : "ofborg-test" . to_owned ( ) ,
571+ } ,
572+ subset : None ,
573+ logs : Some ( ( Some ( String :: from ( "logs" ) ) , Some ( String :: from ( "build.log" ) ) ) ) ,
574+ statusreport : Some ( ( Some ( String :: from ( "build-results" ) ) , None ) ) ,
575+ request_id : "bogus-request-id" . to_owned ( ) ,
576+ } ;
577+
578+ let mut dummyreceiver = notifyworker:: DummyNotificationReceiver :: new ( ) ;
579+
580+ worker. consumer ( & job, & mut dummyreceiver) ;
581+
582+ println ! ( "Total actions: {:?}" , dummyreceiver. actions. len( ) ) ;
583+ let mut actions = dummyreceiver. actions . into_iter ( ) ;
584+ assert_contains_job ( & mut actions, "skipped_attrs\" :[\" success" ) ; // First one to the github poster
585+ assert_contains_job ( & mut actions, "skipped_attrs\" :[\" success" ) ; // This one to the logs
586+ assert_eq ! ( actions. next( ) , Some ( worker:: Action :: Ack ) ) ;
587+ }
588+
535589 #[ test]
536590 pub fn test_all_jobs_skipped ( ) {
537591 let p = TestScratch :: new_dir ( "no-attempt" ) ;
0 commit comments