@@ -16,21 +16,39 @@ describe("gpg", () => {
1616 expect ( mockExec ) . toBeCalledTimes ( 1 ) ;
1717 } ) ;
1818
19- it ( "uses the next keyserver in the pool if the previous fails" , async ( ) => {
20- const failingServers = 3 ;
21- let testedServers = 0 ;
19+ // NOTE: Currently disabled as the pool only contains one server
20+ // it("uses the next keyserver in the pool if the previous fails", async () => {
21+ // const failingServers = 3;
22+ // let testedServers = 0;
23+
24+ // mockExec.mockImplementation(() => {
25+ // testedServers++;
26+ // if (testedServers >= failingServers) {
27+ // return Promise.resolve(0);
28+ // } else {
29+ // return Promise.resolve(1);
30+ // }
31+ // });
32+
33+ // await refreshKeys();
34+ // expect(mockExec).toBeCalledTimes(3);
35+ // });
36+
37+ it ( "makes a second attempt if the keyserver fails" , async ( ) => {
38+ const attempts = 2 ;
39+ let tests = 0 ;
2240
2341 mockExec . mockImplementation ( ( ) => {
24- testedServers ++ ;
25- if ( testedServers >= failingServers ) {
42+ tests ++ ;
43+ if ( tests >= attempts ) {
2644 return Promise . resolve ( 0 ) ;
2745 } else {
2846 return Promise . resolve ( 1 ) ;
2947 }
3048 } ) ;
3149
3250 await refreshKeys ( ) ;
33- expect ( mockExec ) . toBeCalledTimes ( 3 ) ;
51+ expect ( mockExec ) . toBeCalledTimes ( 2 ) ;
3452 } ) ;
3553
3654 it ( "throws an error if all servers in the pool fails" , async ( ) => {
0 commit comments