-
Notifications
You must be signed in to change notification settings - Fork 15
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
Update zookeeper to v3.4.12; migrate tests to TAP #14
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right that this change is just about a patch-level update of ZK? This isn't about the major/minor ZK version upgrades that (a) we eventually want to do and (b) will require us to test and consider upgrade issues.
BUILDIMAGE_PKGSRC = sun-jre6-6.0.26 \ | ||
zookeeper-client-3.4.3 \ | ||
zookeeper-server-3.4.3 | ||
BUILDIMAGE_PKGSRC = openjdk8-1.8.232 zookeeper-3.4.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Say 3.4.12 here. Title says 3.4.11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
test: ensure-node-v6-or-greater-for-test-suite | $(TAP_EXEC) | ||
@testFiles="$(shell ls test/integration/*.test.js | egrep "$(TEST_FILTER)")" && \ | ||
test -z "$$testFiles" || \ | ||
NODE_NDEBUG= $(TAP_EXEC) --timeout $(TEST_TIMEOUT_S) -j $(TEST_JOBS) -o ./test.tap $$testFiles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add these to .gitignore:
/.nyc_output
/test.tap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Makefile
Outdated
deps $(TAP_EXEC): | $(REPO_DEPS) $(NPM_EXEC) | ||
$(NPM_ENV) $(NPM) install | ||
|
||
.PHONY: ensure-node-v6-or-greater-for-test-suite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you need this change. Typically this is running using the specified (currently node v8) sdcnode build. This "ensure-node-v6-or-greater-for-test-suite" guard was originally added for node packages that don't specify a particular sdcnode. It doesn't hurt tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I guess my inclination would be that if it's not strictly necessary then drop it.
Makefile
Outdated
.PHONY: ensure-node-v6-or-greater-for-test-suite | ||
ensure-node-v6-or-greater-for-test-suite: | $(TAP_EXEC) | ||
@NODE_VER=$(shell node --version) && \ | ||
./node_modules/.bin/semver -r '>=6.x' $$NODE_VER >/dev/null || \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are keeping this guard target, then that semver
binary is only there by luck. One should then add a "semver" dep to "devDependencies".
package.json
Outdated
"vasync": "2.1.0", | ||
"verror": "^1.10.0", | ||
"xtend": "1.0.3", | ||
"zkstream": "0.11.8" | ||
}, | ||
"engines": { | ||
"node": ">=0.10" | ||
}, | ||
"devDependencies": { | ||
"expiring-lru-cache": "2.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like nothing calls test/helper.js's createCache
which is the only user of this dependency. Perhaps createCache
and this dep could be dropped.
Please also consider cleaning up helper.js. It's before
, after
, and test
are vestigial now that nodeunit has been dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. I will see if I can drop it, and will do on the cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test/integration/database.test.js
Outdated
var core = require('../lib'); | ||
var core = require('../../lib'); | ||
|
||
var tap = require('tap'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit: Most (all?) our other tap-using test files tend to var test = require('tap').test;
and just use test(...)
in code later.
Note: Any "nit" ever from me in code review is fair game for you to ignore if your preference is otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to get the input!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test/integration/database.test.js
Outdated
if (require.cache[__dirname + '/helper.js']) | ||
delete require.cache[__dirname + '/helper.js']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you consider ditching this require.cache
mucking? It is gross under-the-hood node hacking to ensure that helper.js
is re-loaded for each test module. That was necessary when using nodeunit that ran all the test files in a single process. Node-tap runs each test file in a separate process so it should no longer be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
NODE_PREBUILT_IMAGE = fd2cc906-8938-11e3-beab-4359c665ac99 | ||
NODE_PREBUILT_TAG = zone64 | ||
NODE_PREBUILT_VERSION := v8.17.0 | ||
NODE_PREBUILT_IMAGE = 5417ab20-3156-11ea-8b19-2b66f5e7a439 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could consider taking this Makefile patch that will drop bothering to compile a local node v8 from source when running make all
on non-SmartOS:
diff --git a/Makefile b/Makefile
index e866fbc..d0cbe0d 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,10 @@ ifeq ($(shell uname -s),SunOS)
include ./deps/eng/tools/mk/Makefile.node_prebuilt.defs
include ./deps/eng/tools/mk/Makefile.agent_prebuilt.defs
else
- include ./deps/eng/tools/mk/Makefile.node.defs
+ NPM=npm
+ NODE=node
+ NPM_EXEC=$(shell which npm)
+ NODE_EXEC=$(shell which node)
endif
include ./deps/eng/tools/mk/Makefile.node_modules.defs
include ./deps/eng/tools/mk/Makefile.smf.defs
This is what other repos tend to do. There is no real value in our eng/tools/mk/Makefile.node.* makefiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
"devDependencies": { | ||
"expiring-lru-cache": "2.1.0", | ||
"ejs": "2.7.2", | ||
"nodeunit": "0.11.2" | ||
"tap": "14.10.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to check and discuss is how much bigger this has made the binder final images. That we tend to ship the tests and devDependencies currently in our images means that huge devDeps impact image size, which can slow down builds and upgrades. node-tap is huge, mainly because of its coverage support.
This isn't an answer, but see these two sections for some background: https://github.com/joyent/rfd/blob/master/rfd/0139/README.md#the-bad-with-node-tap and https://github.com/joyent/rfd/blob/master/rfd/0139/README.md#npm-install-smallertap
Also...
If you consider the latter, you migth want that as a separate change to have the commits be cleaner. Also let me know and I can show exampels of other repos having made that change. |
@bowrocker Is there a jira ticket for this work? |
That's right, the idea is just to get us upgrade for now, then move to (a) and (b); this is from the ZK wiki: Supported upgrade path: Existing stable 3.4.x versions should be supported, but in order to get the best results, it's strongly advised to upgrade to the latest stable 3.4 version beforehand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a drive-by review at the moment, but now that we're using modern node and npm, we should check in the package.lock file as generated from the sdcnode release that we're building with.
Good call, done. |
I went with the first option for now, but I will follow up with the latter once this PR is merged. |
Required submodule changes:
Jira issue: MANTA-3543
This change updates the version of Zookeeper to 3.4.12 in addition to updating the existing tests to run under TAP instead of nodeunit.
The tests are passing on a dev zone running zk 3.4.12 locally: