mirror of
https://code.forgejo.org/actions/cache.git
synced 2026-07-21 18:55:50 +00:00
Implemented
This commit is contained in:
parent
88522ab9f3
commit
f12187b90c
29 changed files with 272142 additions and 230372 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import * as cache from "@actions/cache";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import * as cache from "../src/backend";
|
||||
import { Events, Inputs, RefKey } from "../src/constants";
|
||||
import run from "../src/restoreImpl";
|
||||
import { StateProvider } from "../src/stateProvider";
|
||||
|
|
@ -129,7 +129,8 @@ test("restore on GHES with AC available ", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
@ -183,7 +184,8 @@ test("restore with too many keys should fail", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
`Key Validation Error: Keys are limited to a maximum of 10.`
|
||||
|
|
@ -209,7 +211,8 @@ test("restore with large key should fail", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
`Key Validation Error: ${key} cannot be larger than 512 characters.`
|
||||
|
|
@ -235,7 +238,8 @@ test("restore with invalid key should fail", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
`Key Validation Error: ${key} cannot contain commas.`
|
||||
|
|
@ -270,7 +274,8 @@ test("restore with no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
@ -311,7 +316,8 @@ test("restore with restore keys and no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
@ -351,7 +357,8 @@ test("restore with cache found for key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
@ -393,7 +400,8 @@ test("restore with cache found for restore key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
@ -434,7 +442,8 @@ test("restore with lookup-only set", async () => {
|
|||
{
|
||||
lookupOnly: true
|
||||
},
|
||||
false
|
||||
{ credentials: { accessKeyId: "", secretAccessKey: "" }, region: "" },
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue