Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: should return first ethernet addrs #35

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

slyon
Copy link
Contributor

@slyon slyon commented Apr 19, 2023

On Ubuntu's autopkgtest infrastructure, we're seeing a test failure with v1.2.1: https://autopkgtest.ubuntu.com/results/autopkgtest-lunar/lunar/ppc64el/n/node-address/20230419_101818_a5f3b@/log.gz

  test/ts.test.js
    undefined should works with ts without error (11330ms)

  19 passing (11s)
  1 pending
  1 failing

  1) test/address.test.js
       address()
         should return first ethernet addrs:
     AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. Received type object (null)
      at /tmp/autopkgtest.RdWSJJ/autopkgtest_tmp/smoke24Z5Wo/test/address.test.js:34:16
      at /usr/share/nodejs/address/lib/address.js:66:5
      at address.mac (/usr/share/nodejs/address/lib/address.js:205:12)
      at address (/usr/share/nodejs/address/lib/address.js:62:11)
      at Context.<anonymous> (test/address.test.js:31:7)
      at callFnAsync (/usr/share/nodejs/mocha/lib/runnable.js:394:21)
      at Runnable.run (/usr/share/nodejs/mocha/lib/runnable.js:338:7)
      at Runner.runTest (/usr/share/nodejs/mocha/lib/runner.js:666:10)
      at /usr/share/nodejs/mocha/lib/runner.js:789:12
      at next (/usr/share/nodejs/mocha/lib/runner.js:581:14)
      at /usr/share/nodejs/mocha/lib/runner.js:591:7
      at next (/usr/share/nodejs/mocha/lib/runner.js:474:14)
      at Immediate._onImmediate (/usr/share/nodejs/mocha/lib/runner.js:559:5)
      at process.processImmediate (node:internal/timers:471:21)

autopkgtest [10:18:06]: test pkg-js-autopkgtest: -----------------------]
autopkgtest [10:18:06]: test pkg-js-autopkgtest:  - - - - - - - - - - results - - - - - - - - - -
pkg-js-autopkgtest   FAIL non-zero exit status 1

This seems to be related to the refactoring done in PR #27 where the addr.mac && check got removed:

-  describe('address()', function () {
-    it('should return first ethernet addrs', function (done) {
-      address(function (err, addr) {
-        should.not.exists(err);
-        addr.should.have.keys('ip', 'ipv6', 'mac');
-        addr.mac && addr.mac.should.match(/^(?:[a-z0-9]{2}\:){5}[a-z0-9]{2}$/i);
-        addr.ip && addr.ip.should.match(/^\d+\.\d+\.\d+\.\d+$/);
+  describe('address()', () => {
+    it('should return first ethernet addrs', done => {
+      address((err, addr) => {
+        assert(!err);
+        assert.deepStrictEqual(Object.keys(addr), [ 'ip', 'ipv6', 'mac' ]);
+        assert.match(addr.mac, /^(?:[a-z0-9]{2}\:){5}[a-z0-9]{2}$/i);
+        assert.match(addr.ip, /^\d+\.\d+\.\d+\.\d+$/);
         done();

It's propably happening only on systems where the loopback interface is being used, due to a combination of c316a04 and #6

We're using 127.0.0.1 and 127.0.1.1 on lo inside Ubuntu's autopkgtest CI.

…rnet addrs

On Ubuntu's autopkgtest infrastructure, we're seeing a test failure with v1.2.1:
https://autopkgtest.ubuntu.com/results/autopkgtest-lunar/lunar/ppc64el/n/node-address/20230419_101818_a5f3b@/log.gz

```
  test/ts.test.js
    undefined should works with ts without error (11330ms)

  19 passing (11s)
  1 pending
  1 failing

  1) test/address.test.js
       address()
         should return first ethernet addrs:
     AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. Received type object (null)
      at /tmp/autopkgtest.RdWSJJ/autopkgtest_tmp/smoke24Z5Wo/test/address.test.js:34:16
      at /usr/share/nodejs/address/lib/address.js:66:5
      at address.mac (/usr/share/nodejs/address/lib/address.js:205:12)
      at address (/usr/share/nodejs/address/lib/address.js:62:11)
      at Context.<anonymous> (test/address.test.js:31:7)
      at callFnAsync (/usr/share/nodejs/mocha/lib/runnable.js:394:21)
      at Runnable.run (/usr/share/nodejs/mocha/lib/runnable.js:338:7)
      at Runner.runTest (/usr/share/nodejs/mocha/lib/runner.js:666:10)
      at /usr/share/nodejs/mocha/lib/runner.js:789:12
      at next (/usr/share/nodejs/mocha/lib/runner.js:581:14)
      at /usr/share/nodejs/mocha/lib/runner.js:591:7
      at next (/usr/share/nodejs/mocha/lib/runner.js:474:14)
      at Immediate._onImmediate (/usr/share/nodejs/mocha/lib/runner.js:559:5)
      at process.processImmediate (node:internal/timers:471:21)

autopkgtest [10:18:06]: test pkg-js-autopkgtest: -----------------------]
autopkgtest [10:18:06]: test pkg-js-autopkgtest:  - - - - - - - - - - results - - - - - - - - - -
pkg-js-autopkgtest   FAIL non-zero exit status 1
```

This seems to be related to the refactoring done in PR node-modules#27 where the `addr.mac && ` check got removed:
```diff
-  describe('address()', function () {
-    it('should return first ethernet addrs', function (done) {
-      address(function (err, addr) {
-        should.not.exists(err);
-        addr.should.have.keys('ip', 'ipv6', 'mac');
-        addr.mac && addr.mac.should.match(/^(?:[a-z0-9]{2}\:){5}[a-z0-9]{2}$/i);
-        addr.ip && addr.ip.should.match(/^\d+\.\d+\.\d+\.\d+$/);
+  describe('address()', () => {
+    it('should return first ethernet addrs', done => {
+      address((err, addr) => {
+        assert(!err);
+        assert.deepStrictEqual(Object.keys(addr), [ 'ip', 'ipv6', 'mac' ]);
+        assert.match(addr.mac, /^(?:[a-z0-9]{2}\:){5}[a-z0-9]{2}$/i);
+        assert.match(addr.ip, /^\d+\.\d+\.\d+\.\d+$/);
         done();
```

It's propably happening only on systems where the lo interface is being used,
due to node-modules@c316a04
and node-modules#6

We're using 127.0.0.1 and 127.0.1.1 on Ubuntu's autopkgtest CI.
@slyon
Copy link
Contributor Author

slyon commented Apr 19, 2023

@fengmk2 fengmk2 changed the title address.test.js: Fix v1.2.1 refactoring for: should return first ethernet addrs test: should return first ethernet addrs Apr 19, 2023
@fengmk2 fengmk2 merged commit 573eef9 into node-modules:master Apr 19, 2023
11 checks passed
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.

None yet

2 participants