Skip to content

Commit

Permalink
test: fix macos terraform tests (#11204)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Aug 10, 2021
1 parent fa2317e commit 04fd4de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
6 changes: 2 additions & 4 deletions lib/manager/terraform/lockfile/hash.spec.ts
Expand Up @@ -20,14 +20,12 @@ const log = logger.logger as jest.Mocked<Logger>;
describe(getName(), () => {
let cacheDir: DirectoryResult;

beforeAll(async () => {
beforeEach(async () => {
cacheDir = await dir({ unsafeCleanup: true });
setAdminConfig({ cacheDir: cacheDir.path });
});

beforeEach(() => jest.resetAllMocks());

afterAll(() => cacheDir.cleanup());
afterEach(() => cacheDir.cleanup());

it('returns null if getBuilds returns null', async () => {
httpMock
Expand Down
9 changes: 2 additions & 7 deletions lib/manager/terraform/lockfile/hash.ts
Expand Up @@ -27,9 +27,7 @@ export class TerraformProviderHash {
// a sha256sum displayed as lowercase hex string to root hash
const fileBuffer = await fs.readFile(file);
hash.update(fileBuffer);
hash.end();
const data = hash.read();
rootHash.update(data.toString('hex'));
rootHash.update(hash.digest('hex'));

// add double space, the filename and a new line char
rootHash.update(' ');
Expand All @@ -38,10 +36,7 @@ export class TerraformProviderHash {
rootHash.update('\n');
}

rootHash.end();
const rootData = rootHash.read();
const result: string = rootData.toString('base64');
return result;
return rootHash.digest('base64');
}

static async hashOfZipContent(
Expand Down

0 comments on commit 04fd4de

Please sign in to comment.