Skip to content

Commit ef990e6

Browse files
fix: improve port cleanup and increase timeouts for federated-css tests
- Enhanced port cleanup in federated-css with multiple retry attempts - Increased prewarm timeout from 120s to 300s in federated-css-react-ssr - Added more robust port killing with delays to ensure ports are fully released These changes address CI failures due to port conflicts and timeout issues when running tests in resource-constrained CI environments.
1 parent 07595f3 commit ef990e6

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

federated-css-react-ssr/shell-apps/css-jss/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
55
const app = express();
66
const PORT = 4000;
77

8-
async function waitUrl(url, timeout = 120000) {
8+
async function waitUrl(url, timeout = 300000) {
99
const start = Date.now();
1010
// Retry until the remoteEntry.js is available over HTTP
1111
/* eslint-disable no-await-in-loop */

federated-css-react-ssr/shell-apps/css-scss/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
55
const app = express();
66
const PORT = 4001;
77

8-
async function waitUrl(url, timeout = 120000) {
8+
async function waitUrl(url, timeout = 300000) {
99
const start = Date.now();
1010
while (true) {
1111
try {

federated-css-react-ssr/shell-apps/jss-styled-components-css-module/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
55
const app = express();
66
const PORT = 4003;
77

8-
async function waitUrl(url, timeout = 120000) {
8+
async function waitUrl(url, timeout = 300000) {
99
const start = Date.now();
1010
while (true) {
1111
try {

federated-css-react-ssr/shell-apps/jss-styled-components/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
55
const app = express();
66
const PORT = 4002;
77

8-
async function waitUrl(url, timeout = 120000) {
8+
async function waitUrl(url, timeout = 300000) {
99
const start = Date.now();
1010
while (true) {
1111
try {

federated-css-react-ssr/shell-apps/less-scss/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
55
const app = express();
66
const PORT = 4004;
77

8-
async function waitUrl(url, timeout = 120000) {
8+
async function waitUrl(url, timeout = 300000) {
99
const start = Date.now();
1010
while (true) {
1111
try {

federated-css-react-ssr/shell-apps/scss-tailwind-css/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fetch = require('node-fetch');
55
const app = express();
66
const PORT = 4005;
77

8-
async function waitUrl(url, timeout = 120000) {
8+
async function waitUrl(url, timeout = 300000) {
99
const start = Date.now();
1010
while (true) {
1111
try {

federated-css/scripts/start-all.cjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,15 @@ async function main() {
122122
// Extra cleanup for each Next.js port in case previous one didn't clean up properly
123123
console.log(`[federated-css] cleaning up port ${port} before starting ${dir}...`);
124124
await killPort(port);
125-
await new Promise(resolve => setTimeout(resolve, 2000)); // Longer delay to ensure port is released
125+
// Try multiple times to ensure port is really free
126+
for (let i = 0; i < 3; i++) {
127+
try {
128+
await killPort(port);
129+
} catch (e) {
130+
// Ignore, port might already be free
131+
}
132+
await new Promise(resolve => setTimeout(resolve, 1000));
133+
}
126134
const cwd = path.join('consumers-nextjs', dir);
127135
const p = run('pnpm', ['-C', cwd, 'run', 'start']);
128136
procs.push(p);

0 commit comments

Comments
 (0)