@@ -28,7 +28,7 @@ const notFound = (method: string, path: string) =>
2828 } ) ;
2929
3030/** An Ubuntu host with the userns restriction on, the browser installed, and a system font. */
31- const runSetup = ( input : { readonly uid : number ; readonly profile : string | undefined } ) => {
31+ const runSetupAsRoot = ( input : { readonly profile : string | undefined } ) => {
3232 const files = new Map ( [
3333 [ USERNS_RESTRICTION , "1\n" ] ,
3434 [ BROWSER , "" ] ,
@@ -94,7 +94,7 @@ const runSetup = (input: { readonly uid: number; readonly profile: string | unde
9494 } ;
9595 } ) . pipe (
9696 Effect . provideService ( HostProcess . Platform , "linux" ) ,
97- Effect . provideService ( HostProcess . UserId , input . uid ) ,
97+ Effect . provideService ( HostProcess . UserId , 0 ) ,
9898 Effect . provideService ( HostProcess . Environment , { SUDO_USER : "me" } ) ,
9999 Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , spawner ) ,
100100 Effect . provideService ( FileSystem . FileSystem , fileSystem ) ,
@@ -118,20 +118,10 @@ it.effect.each([
118118 } ,
119119] ) ( "t3 browser setup as root $label" , ( input ) =>
120120 Effect . gen ( function * ( ) {
121- const result = yield * runSetup ( { uid : 0 , profile : input . profile } ) ;
121+ const result = yield * runSetupAsRoot ( { profile : input . profile } ) ;
122122 expect ( result . loads ) . toEqual ( [ LOAD ] ) ;
123123 expect ( result . profile ) . toBe ( PreviewBrowserHost . APPARMOR_PROFILE ) ;
124124 expect ( result . output ) . toContain ( input . said ) ;
125125 expect ( result . output ) . toContain ( "This host is ready for T3's browser." ) ;
126126 } ) ,
127127) ;
128-
129- it . effect ( "t3 browser setup without root says a profile on disk may not be loaded" , ( ) =>
130- Effect . gen ( function * ( ) {
131- const result = yield * runSetup ( { uid : 1000 , profile : PreviewBrowserHost . APPARMOR_PROFILE } ) ;
132- expect ( result . loads ) . toEqual ( [ ] ) ;
133- expect ( result . output ) . toContain ( "is not loaded. To load it, run:" ) ;
134- expect ( result . output ) . toContain ( "sudo" ) ;
135- expect ( result . output ) . toContain ( "browser setup --base-dir /home/me/.t3" ) ;
136- } ) ,
137- ) ;
0 commit comments