Skip to content

Commit

Permalink
ci: fix port usage on ci.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardo2016 committed Apr 17, 2024
1 parent 29ab2d5 commit 06e9ede
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
},
"devDependencies": {
"@fibjs/ci": "^2.7.1",
"@fibjs/detect-port": "^1.0.2",
"@fibjs/types": "^0.35.0",
"cross-env": "^5.2.0",
"fib-pool": "^1.6.0",
Expand Down
14 changes: 8 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const pool = require('fib-pool');
const util = require('util');
const coroutine = require('coroutine');

const detect_port = require('@fibjs/detect-port');

const { startServer, stopServer } = require('./spec_helper');

// the assertions before `wait()` might fail if the leading operations take too long to finish
Expand All @@ -25,7 +27,7 @@ let wait = function (n = delay) {
let url = {
protocol: 'http',
domain: '127.0.0.1',
port: 8080,
port: detect_port(),
get ['host']() {
return this.protocol + '://' + this.domain + ':' + this.port
},
Expand Down Expand Up @@ -82,7 +84,7 @@ function session_test(description, opts, test_opts, _before, _after) {
after(() => stopServer(srv));

it('server', () => {
++url.port;
url.port = detect_port();

srv = new http.Server(url.port, [
session.cookie_filter,
Expand Down Expand Up @@ -396,7 +398,7 @@ function session_test(description, opts, test_opts, _before, _after) {
after(() => stopServer(srv));

it('server', () => {
++url.port;
url.port = detect_port();
srv = new http.Server(url.port, [
session.cookie_filter,
{
Expand Down Expand Up @@ -468,7 +470,7 @@ function session_test(description, opts, test_opts, _before, _after) {
after(() => stopServer(srv));

it('server', () => {
++url.port;
url.port = detect_port();
srv = new http.Server(url.port, [
session.api_filter,
{
Expand Down Expand Up @@ -944,7 +946,7 @@ function session_test(description, opts, test_opts, _before, _after) {
let srv;
after(() => stopServer(srv));
it('check token', () => {
++url.port;
url.port = detect_port();
srv = new http.Server(url.port, [
session.cookie_filter,
(r) => {
Expand Down Expand Up @@ -1054,7 +1056,7 @@ function session_test(description, opts, test_opts, _before, _after) {
after(() => stopServer(srv));

it('server', () => {
++url.port;
url.port = detect_port();
srv = new http.Server(url.port, [
(r) => {
try {
Expand Down

0 comments on commit 06e9ede

Please sign in to comment.