ZAPI-808: vms.changefeed.test.js race with changefeed listener

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2017-10-18T18:16:38.000Z)

Fix Versions

2017-10-26 Da-Chao (Release Date: 2017-10-26)

Related Links

Description

When testing vminfod, sometimes the sdc-vmapi test suite will fail with this error:

TAP version 13
# find_headnode
ok 1 no error
ok 2 200 OK
ok 3 servers is set
ok 4 servers is Array
ok 5 server found
# napi_networks_ok
ok 6 no error
ok 7 200 OK
ok 8 networks is set
ok 9 networks is Array
ok 10 more than 1 network found
# create_vm
/opt/smartdc/vmapi/test/vms.changefeed.test.js:267
            changeItem.changedResourceId === VM.uuid &&
                                               ^

TypeError: Cannot read property 'uuid' of null
    at Listener.<anonymous> (/opt/smartdc/vmapi/test/vms.changefeed.test.js:267:48)
    at emitNone (events.js:67:13)
    at Listener.emit (events.js:166:7)
    at emitReadable_ (_stream_readable.js:419:10)
    at emitReadable (_stream_readable.js:413:7)
    at readableAddChunk (_stream_readable.js:164:13)
    at Listener.Readable.push (_stream_readable.js:111:10)
    at WatershedConnection._receivedText (/opt/smartdc/vmapi/node_modules/changefeed/lib/listener.js:195:30)
    at emitOne (events.js:77:13)
    at WatershedConnection.emit (events.js:169:7)

It appears as though an event from the changefeed can get processed before the call to client.get can complete, which is used to determine the VMs UUID.

Comments

Comment by Dave Eddy
Created at 2017-10-13T17:29:48.000Z
CR: https://cr.joyent.us/#/c/2781/

Comment by Bot Bot [X]
Created at 2017-10-18T18:16:40.000Z

sdc-vmapi commit 537b4b1 (branch master, by Dave Eddy)

ZAPI-808 vms.changefeed.test.js race with changefeed listener
    Reviewed by: Julien Gilli <julien.gilli@joyent.com>
    Approved by: Julien Gilli <julien.gilli@joyent.com>