diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 86a8317ec..b0a3673a1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,4 +1,4 @@ -name: ci +name: integration tests on: [push] diff --git a/tests/integration/catalog.serial.test.ts b/tests/integration/catalog.serial.test.ts index 9d8d26c0e..5fc596796 100644 --- a/tests/integration/catalog.serial.test.ts +++ b/tests/integration/catalog.serial.test.ts @@ -111,113 +111,6 @@ describe("Catalog API", () => { expect(deleteCatalogObjectsResp.deletedObjectIds).toHaveLength(200); }, 240_000); - it("should upload catalog image", async () => { - // Add retry logic for the image upload - const maxRetries = 5; // Increased from 3 to 5 - let lastError = null; - - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - // If this isn't the first attempt, wait before retrying - if (attempt > 0) { - console.log(`Attempt ${attempt + 1} for image upload...`); - // Increase wait time between retries exponentially - await sleep(2 ** attempt * 5000); - } - - console.log(`Starting image upload attempt ${attempt + 1}`); - - // Setup: Load a test image file - const imageFile = await getTestFile(); - console.log("Test file loaded"); - - // Setup: Create a catalog object to associate the image with - const catalogObject = createTestCatalogItem(); - - // Add delay before catalog creation - await sleep(3000); - console.log("Creating catalog object..."); - - const createCatalogResp = await client.catalog.batchUpsert( - { - idempotencyKey: newTestUuid(), - batches: [ - { - objects: [catalogObject], - }, - ], - }, - { - maxRetries: MAX_RETRIES_CATALOG, - timeoutInSeconds: MAX_TIMEOUT, - }, - ); - - console.log("Catalog object created"); - expect(createCatalogResp.objects).toHaveLength(1); - const createdCatalogObject = createCatalogResp.objects?.[0]; - expect(createdCatalogObject).toBeDefined(); - - // Add delay before image upload - await sleep(5000); - console.log("Uploading image..."); - - // Create a new catalog image - const imageName = `Test Image ${newTestUuid()}`; - const createCatalogImageResp = await client.catalog.images.create( - { - imageFile, - request: { - idempotencyKey: newTestUuid(), - objectId: createdCatalogObject?.id, - image: { - type: "IMAGE", - id: newTestSquareTempId(), - imageData: { - name: imageName, - }, - }, - }, - }, - { - maxRetries: MAX_RETRIES_CATALOG, - timeoutInSeconds: 180, // Increased timeout for image upload - }, - ); - - console.log("Image uploaded successfully"); - expect(createCatalogImageResp.image).toBeDefined(); - - // Add delay before cleanup - await sleep(3000); - console.log("Starting cleanup..."); - - // Cleanup: Delete the created catalog object and image - await client.catalog.batchDelete( - { - objectIds: [createdCatalogObject?.id!, createCatalogImageResp.image?.id!], - }, - { - maxRetries: MAX_RETRIES_CATALOG, - timeoutInSeconds: MAX_TIMEOUT, - }, - ); - - console.log("Cleanup completed"); - // If we get here, the test succeeded, so break out of retry loop - return; - } catch (error) { - lastError = error; - console.log(`Attempt ${attempt + 1} failed with error:`, error); - // If this was the last attempt, the error will be thrown below - } - } - - // If we get here, all retries failed - console.log("All image upload attempts failed"); - throw lastError; - }, 360_000); - it("should test upsert catalog object", async () => { const coffee = createTestCatalogItem({ name: "Coffee",