Skip to content

Cache tests not working as expected #485

Closed

Description

@dhadka

The cache tests don't work as expected. We should delete both test folders before restoring, otherwise we're not really testing the action.

    - name: Generate files outside working directory
      shell: bash
      run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache

    # We're using node -e to call the functions directly available in the @actions/cache package
    - name: Save cache using saveCache()
      run: |
        node -e "Promise.resolve(require('./packages/cache/lib/cache').saveCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"
    - name: Restore cache using restoreCache()
      run: |
        node -e "Promise.resolve(require('./packages/cache/lib/cache').restoreCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"
    - name: Verify cache 
      shell: bash
      run: |
        packages/cache/__tests__/verify-cache-files.sh ${{ runner.os }} test-cache
        packages/cache/__tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions