Skip to content

Conversation

@gugu
Copy link
Contributor

@gugu gugu commented Dec 5, 2025

No description provided.

@gugu gugu requested review from Artuomka and Copilot and removed request for Copilot December 5, 2025 14:45
Copilot AI review requested due to automatic review settings December 8, 2025 12:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables parallel test execution by transitioning from a shared test admin user to creating unique, isolated user instances for each test. The key changes support concurrent test runs without data collisions.

  • Removed --serial flag from the test-all script in package.json to enable parallel test execution
  • Refactored registerUserAndReturnUserInfo to create unique users directly in the database for each test instead of logging into a shared admin account
  • Introduced setupUserWithSecrets helper function to streamline test setup and reduce code duplication

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
backend/package.json Removed --serial flag from test-all script to enable parallel test execution
backend/test/utils/register-user-and-return-user-info.ts Refactored to create unique users with randomly generated credentials instead of reusing a shared admin account
backend/test/ava-tests/non-saas-tests/non-saas-secrets-e2e.test.ts Added setupUserWithSecrets helper and updated tests to use unique secret slugs for test isolation
backend/test/ava-tests/non-saas-tests/non-saas-connection-e2e.test.ts Added assertion to verify connection creation succeeded

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.set('masterpwd', 'ahalaimahalai')
.set('Content-Type', 'application/json')
.set('Accept', 'application/json');

Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setupUserWithSecrets helper function does not validate the response status when creating the connection. If the connection creation fails, the function will attempt to parse undefined or error text as JSON, causing a runtime error that's hard to debug.

Consider checking the response status:

const createdConnection = await request(app.getHttpServer())
  .post('/connection')
  .send(newConnection)
  .set('Cookie', token)
  .set('masterpwd', 'ahalaimahalai')
  .set('Content-Type', 'application/json')
  .set('Accept', 'application/json');

if (createdConnection.status !== 201) {
  throw new Error(`Failed to create connection: ${createdConnection.text}`);
}

const connectionId = JSON.parse(createdConnection.text).id;
Suggested change
if (createdConnection.status !== 201) {
throw new Error(`Failed to create connection: ${createdConnection.text}`);
}

Copilot uses AI. Check for mistakes.
import { DataSource } from 'typeorm';
import { Constants } from '../../src/helpers/constants/constants.js';
import { TestUtils } from './test.utils.js';
import { isSaaS } from '../../src/helpers/app/is-saas.js';
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isSaaS import is no longer used after refactoring the registerUserAndReturnUserInfo function to always create users directly in the database. Consider removing this unused import to keep the code clean.

Suggested change
import { isSaaS } from '../../src/helpers/app/is-saas.js';

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +47
await request(app.getHttpServer())
.post('/secrets')
.set('Cookie', token)
.set('masterpwd', 'ahalaimahalai')
.set('Content-Type', 'application/json')
.set('Accept', 'application/json')
.send(secret);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setupUserWithSecrets helper function does not validate the response status when creating secrets. If the secret creation fails (e.g., due to validation errors or server issues), the test will continue without awareness of the failure, potentially causing confusing test results.

Consider checking the response status for each secret creation:

for (const secret of secrets) {
  const response = await request(app.getHttpServer())
    .post('/secrets')
    .set('Cookie', token)
    .set('masterpwd', 'ahalaimahalai')
    .set('Content-Type', 'application/json')
    .set('Accept', 'application/json')
    .send(secret);
  
  if (response.status !== 201) {
    throw new Error(`Failed to create secret: ${response.text}`);
  }
}
Suggested change
await request(app.getHttpServer())
.post('/secrets')
.set('Cookie', token)
.set('masterpwd', 'ahalaimahalai')
.set('Content-Type', 'application/json')
.set('Accept', 'application/json')
.send(secret);
const response = await request(app.getHttpServer())
.post('/secrets')
.set('Cookie', token)
.set('masterpwd', 'ahalaimahalai')
.set('Content-Type', 'application/json')
.set('Accept', 'application/json')
.send(secret);
if (response.status !== 201) {
throw new Error(`Failed to create secret: ${response.text}`);
}

Copilot uses AI. Check for mistakes.
@gugu gugu enabled auto-merge (squash) December 8, 2025 17:15
@gugu gugu merged commit f721c1a into main Dec 9, 2025
17 checks passed
@gugu gugu deleted the parallel-tests branch December 9, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants