Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache: gzip tests fail on Windows #797

Open
rcowsill opened this issue May 7, 2021 · 0 comments
Open

Cache: gzip tests fail on Windows #797

rcowsill opened this issue May 7, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@rcowsill
Copy link
Contributor

rcowsill commented May 7, 2021

Describe the bug
On Windows the tests for the cache package currently don't all pass. The tar/gzip related tests have a number of errors.

The errors are due to the following Windows-specific changes:

  • exec is used to check the GNU tar version (extra call to the stub)
  • GNU tar gets an extra option --force-local
  • tar is called without the full absolute path

To Reproduce
On a Windows machine:

  1. Clone actions/toolkit
  2. On main branch, run the following commands:
    npm i
    npm run bootstrap
    npm run build
    npm run test -- packages/cache
    

Expected behavior
All tests pass on Windows

Actual behavior

 FAIL  packages/cache/__tests__/tar.test.ts
  V zstd extract tar (5ms)
  × gzip extract tar (3ms)
  V gzip extract GNU tar on windows (1ms)
  V zstd create tar (5ms)
  × gzip create tar (7ms)
  V zstd list tar (2ms)
  V zstdWithoutLong list tar
  × gzip list tar (2ms)

  ? gzip extract tar

    expect(jest.fn()).toHaveBeenCalledTimes(1)

    Expected mock function to have been called one time, but it was called two times.

      78 |     ? `${process.env['windir']}\\System32\\tar.exe`
      79 |     : defaultTarPath
    > 80 |   expect(execMock).toHaveBeenCalledTimes(1)
         |                    ^
      81 |   expect(execMock).toHaveBeenCalledWith(
      82 |     `"${tarPath}"`,
      83 |     [

      at packages/cache/__tests__/tar.test.ts:80:20
      at fulfilled (packages/cache/__tests__/tar.test.ts:24:58)

  ? gzip create tar

    expect(jest.fn()).toHaveBeenCalledWith(expected)

    Expected mock function to have been called with:
      "\"C:\\Windows\\System32\\tar.exe\""
    as argument 1, but it was called with
      "\"tar\"".
      ["--posix", "-z", "-cf", "cache.tgz", "-P", "-C", "[...]/toolkit", "--files-from", "manifest.txt"]
    as argument 2, but it was called with
      ["--posix", "-z", "-cf", "cache.tgz", "-P", "-C", "[...]/toolkit", "--files-from", "manifest.txt", "--force-local"].

    Difference:

    - Expected
    + Received

      Array [
        "--posix",
        "-z",
        "-cf",
        "cache.tgz",
        "-P",
        "-C",
        "[...]/toolkit",
        "--files-from",
        "manifest.txt",
    +   "--force-local",
      ]

      174 |
      175 |   expect(execMock).toHaveBeenCalledTimes(1)
    > 176 |   expect(execMock).toHaveBeenCalledWith(
          |                    ^
      177 |     `"${tarPath}"`,
      178 |     [
      179 |       '--posix',

      at packages/cache/__tests__/tar.test.ts:176:20
      at fulfilled (packages/cache/__tests__/tar.test.ts:24:58)

  ? gzip list tar

    expect(jest.fn()).toHaveBeenCalledWith(expected)

    Expected mock function to have been called with:
      "\"C:\\Windows\\System32\\tar.exe\""
    as argument 1, but it was called with
      "\"tar\"".
      ["-z", "-tf", "C:/Windows/fakepath/cache.tar", "-P"]
    as argument 2, but it was called with
      ["-z", "-tf", "C:/Windows/fakepath/cache.tar", "-P", "--force-local"].

    Difference:

    - Expected
    + Received

      Array [
        "-z",
        "-tf",
        "C:/Windows/fakepath/cache.tar",
        "-P",
    +   "--force-local",
      ]

      255 |     : defaultTarPath
      256 |   expect(execMock).toHaveBeenCalledTimes(1)
    > 257 |   expect(execMock).toHaveBeenCalledWith(
          |                    ^
      258 |     `"${tarPath}"`,
      259 |     [
      260 |       '-z',

      at packages/cache/__tests__/tar.test.ts:257:20
      at fulfilled (packages/cache/__tests__/tar.test.ts:24:58)

Desktop:

  • OS: Windows
@rcowsill rcowsill added the bug Something isn't working label May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant