mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-03-31 20:17:48 +02:00
Fix test
This commit is contained in:
parent
0748517b1b
commit
589948e5a6
6 changed files with 84 additions and 28 deletions
|
@ -81,7 +81,9 @@ test("restore with no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -124,7 +126,9 @@ test("restore with restore keys and no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -166,7 +170,9 @@ test("restore with cache found for key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -211,7 +217,9 @@ test("restore with cache found for restore key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -256,7 +264,9 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -299,7 +309,9 @@ test("restore when fail on cache miss is enabled and primary key doesn't match r
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -345,7 +357,9 @@ test("restore with fail on cache miss disabled and no cache found", async () =>
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
|
@ -129,7 +129,9 @@ test("restore on GHES with AC available ", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -183,7 +185,9 @@ test("restore with too many keys should fail", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
`Key Validation Error: Keys are limited to a maximum of 10.`
|
||||
|
@ -209,7 +213,9 @@ test("restore with large key should fail", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
`Key Validation Error: ${key} cannot be larger than 512 characters.`
|
||||
|
@ -235,7 +241,9 @@ test("restore with invalid key should fail", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
`Key Validation Error: ${key} cannot contain commas.`
|
||||
|
@ -270,7 +278,9 @@ test("restore with no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -311,7 +321,9 @@ test("restore with restore keys and no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -351,7 +363,9 @@ test("restore with cache found for key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -393,7 +407,9 @@ test("restore with cache found for restore key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
@ -434,7 +450,9 @@ test("restore with lookup-only set", async () => {
|
|||
{
|
||||
lookupOnly: true
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||
|
|
|
@ -82,7 +82,9 @@ test("restore with no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||
|
@ -124,7 +126,9 @@ test("restore with restore keys and no cache found", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||
|
@ -163,7 +167,9 @@ test("restore with cache found for key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||
|
@ -206,7 +212,9 @@ test("restore with cache found for restore key", async () => {
|
|||
{
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||
|
|
|
@ -109,7 +109,9 @@ test("save with valid inputs uploads a cache", async () => {
|
|||
{
|
||||
uploadChunkSize: 4000000
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||
|
|
|
@ -170,7 +170,9 @@ test("save on GHES with AC available", async () => {
|
|||
{
|
||||
uploadChunkSize: 4000000
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||
|
@ -266,7 +268,9 @@ test("save with large cache outputs warning", async () => {
|
|||
[inputPath],
|
||||
primaryKey,
|
||||
expect.anything(),
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(logWarningMock).toHaveBeenCalledTimes(1);
|
||||
|
@ -313,7 +317,9 @@ test("save with reserve cache failure outputs warning", async () => {
|
|||
[inputPath],
|
||||
primaryKey,
|
||||
expect.anything(),
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(logWarningMock).toHaveBeenCalledWith(
|
||||
|
@ -356,7 +362,9 @@ test("save with server error outputs warning", async () => {
|
|||
[inputPath],
|
||||
primaryKey,
|
||||
expect.anything(),
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(logWarningMock).toHaveBeenCalledTimes(1);
|
||||
|
@ -401,7 +409,9 @@ test("save with valid inputs uploads a cache", async () => {
|
|||
{
|
||||
uploadChunkSize: 4000000
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||
|
|
|
@ -99,7 +99,9 @@ test("save with valid inputs uploads a cache", async () => {
|
|||
{
|
||||
uploadChunkSize: 4000000
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||
|
@ -131,7 +133,9 @@ test("save failing logs the warning message", async () => {
|
|||
{
|
||||
uploadChunkSize: 4000000
|
||||
},
|
||||
false
|
||||
false,
|
||||
undefined,
|
||||
""
|
||||
);
|
||||
|
||||
expect(warningMock).toHaveBeenCalledTimes(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue