Skip to content

Commit

Permalink
[4.2.x] Fix address util test for loopback of ipv6 API-1193 (#1182)
Browse files Browse the repository at this point in the history
* Fix address util test for loopback of ipv6 (#1095)

* Fix address util test for loopback of ipv6

* Delete `.be` s

Co-authored-by: Metin Dumandag <metindumandag@gmail.com>

Co-authored-by: Metin Dumandag <metindumandag@gmail.com>

* Add CI workflow

* Add chai as promised to addressutiltest

Co-authored-by: Metin Dumandag <metindumandag@gmail.com>
  • Loading branch information
srknzl and mdumandag committed Feb 21, 2022
1 parent cd3bcdf commit 299d92e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
4 changes: 0 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
"before": true
}
],
"linebreak-style": [
"warn",
"unix"
],
"max-len": [
"warn",
{
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run tests
on:
push:
branches-ignore:
- 'gh-pages'
tags-ignore:
- '*'
pull_request:

jobs:
run-tests:
name: Run Tests on (${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]

steps:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 10
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies and compile client
run: |
npm install
npm run compile
- name: Run OS tests
if: ${{ github.event_name == 'pull_request' }}
run: |
npm run coverage
- name: Run Enterprise tests
if: ${{ github.event_name == 'push' }}
env:
HAZELCAST_ENTERPRISE_KEY: ${{ secrets.HAZELCAST_ENTERPRISE_KEY }}
run: |
npm run coverage
- name: Publish to Codecov
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v2
with:
files: coverage/lcov.info
12 changes: 7 additions & 5 deletions test/unit/util/AddressUtilTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
'use strict';

const { expect } = require('chai');
const chai = require('chai');
const expect = chai.expect;
chai.use(require('chai-as-promised'));
const net = require('net');
const {
createAddressFromString,
Expand Down Expand Up @@ -150,14 +152,14 @@ describe('AddressUtilTest', function () {
expect(result).to.be.false;
});

it('resolveAddress: returns IPv4 for localhost with port', async function () {
it('resolveAddress: returns loopback address for localhost with port', async function () {
const result = await resolveAddress('localhost:5701');
expect(result).to.be.equal('127.0.0.1');
expect(result).to.satisfy(ip => ip === '127.0.0.1' || ip === '::1');
});

it('resolveAddress: returns IPv4 for localhost without port', async function () {
it('resolveAddress: returns loopback address for localhost without port', async function () {
const result = await resolveAddress('localhost');
expect(result).to.be.equal('127.0.0.1');
expect(result).to.satisfy(ip => ip === '127.0.0.1' || ip === '::1');
});

it('resolveAddress: returns IPv4 for IPv4 address with port', async function () {
Expand Down

0 comments on commit 299d92e

Please sign in to comment.