Skip to content

Commit

Permalink
TOOLS-1556 update node-sdc-clients to support node v4
Browse files Browse the repository at this point in the history
Reviewed by: Josh Wilsdon <josh@wilsdon.ca>
  • Loading branch information
trentm committed Oct 3, 2016
1 parent b484447 commit 9b4d4a3
Show file tree
Hide file tree
Showing 29 changed files with 2,048 additions and 3,590 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,3 +9,4 @@ cscope.out
.lvimrc
*.vim
npm-shrinkwrap.json.old
.DS_Store
20 changes: 19 additions & 1 deletion CHANGES.md
Expand Up @@ -5,11 +5,29 @@
-->

<!--
Copyright (c) 2016, Joyent, Inc.
Copyright 2016 Joyent, Inc.
-->

# sdc-clients Changelog

## 10.0.0

- Update dependencies and code to support working with node v4. The most
significant change is from a forked version of restify@2.8.5 (which added
a few patches for HTTP proxy support) to current restify-clients@1.x
and restify-errors@3.x.

Note: until <https://github.com/restify/node-restify/issues/878> work is
upstreamed to a restify-clients release, this will still be using a fork (but
a more modern one).

- [Backward incompatible] Drop the "UFDS" client from this package. A long
while back, it was split out to the separate
[node-ufds](https://github.com/joyent/node-ufds) repo and `ufds` npm package.
Users should switch to that. Get at least ufds@1.2.0 for node v4 support.
UFDS client docs were moved to node-ufds in CAPI-524.


## 9.5.1

- IMGAPI-586: Change the endpoint URL for IMGAPI AdminReloadAuthKeys.
Expand Down
43 changes: 6 additions & 37 deletions Makefile
Expand Up @@ -5,7 +5,7 @@
#

#
# Copyright (c) 2014, Joyent, Inc.
# Copyright 2016 Joyent, Inc.
#

#
Expand All @@ -26,8 +26,6 @@
# Tools
#
NPM := npm
NODEUNIT := ./node_modules/.bin/nodeunit
NODEUNIT_ARGS ?=

#
# Files
Expand All @@ -48,47 +46,18 @@ include ./tools/mk/Makefile.defs
all:
$(NPM) install && $(NPM) rebuild

.PHONY: test ca_test ufds_test vmapi_test cnapi_test amon_test napi_test imgapi_test papi_test

ca_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/ca.test.js

vmapi_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/vmapi.test.js

cnapi_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/cnapi.test.js

ufds_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/ufds.test.js

amon_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/amon.test.js

napi_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/napi.test.js

dsapi_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/dsapi.test.js

papi_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/papi.test.js

cns_test: $(NODEUNIT)
$(NODEUNIT) $(NODEUNIT_ARGS) test/cns.test.js

test: ca_test ufds_test cnapi_test napi_test vmapi_test papi_test cns_test

.PHONY: setup
setup:
$(NPM) install
.PHONY: test-in-coal
test-in-coal:
./test/runtests -H root@10.99.99.7

# Ensure CHANGES.md and package.json have the same version.
.PHONY: versioncheck
versioncheck:
@echo version is: $(shell cat package.json | json version)
[[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -1 | awk '{print $$2}'` ]]

check:: versioncheck

.PHONY: cutarelease
cutarelease: versioncheck
[[ -z `git status --short` ]] # If this fails, the working dir is dirty.
Expand Down
103 changes: 31 additions & 72 deletions README.md
Expand Up @@ -15,97 +15,56 @@ guidelines](https://github.com/joyent/triton/blob/master/CONTRIBUTING.md) --
*Triton does not use GitHub PRs* -- and general documentation at the main
[Triton project](https://github.com/joyent/triton) page.

Node.js client libraries for the various SDC REST API services: Amon, CA,
CNAPI, NAPI, UFDS, Packages on top of UFDS and VMAPI so far.
This repository holds Node.js client libraries for many of the core Triton REST APIs:
Amon, CA, CNS, CNAPI, FWAPI, IMGAPI, NAPI, PAPI, SAPI, VMAPI.

## Testing

Short version:

make test

Of course, you may want to read some assumptions we made in order to ensure
the previous `make test` will run successfully.
Node.js client libraries for other Triton APIs are in other repos. For example see:
- [node-ufds](https://github.com/node-ufds): client for Triton's core UFDS service
- [node-moray](https://github.com/node-moray): client for Triton's core Moray service
- [node-triton](https://github.com/node-triton): Triton CloudAPI client and CLI
- [node-manta](https://github.com/node-manta): Manta client and CLI

Currently, every `test/*.test.js` file can be run separately as a different
test suite by issuing the proper commands:

AMON_IP=10.99.99.20 \
MACHINE_UUID=f56dbb40-1c81-4047-9d56-73fc3adf2b99 \
make amon_test

CA_IP=10.99.99.24 make ca_test

make cnapi_test
## Testing

make ufds_test
To run the tests from a Triton DataCenter global zone:

make package_test
./test/runtests

make vmapi_test
Or to run the test suite remotely (say you are developing on Mac and want to test
against your CoaL):

make napi_test
./test/runtests -H root@10.99.99.7

make imgapi_test
To run a single one of the files use the `-f FILTER` option, e.g.

make papi_test
./test/runtests -H root@10.99.99.7 -f ./test/napi.test.js

Each one of this commands assumes you've got a running version of the proper
API service.

For every service, the following environment variables can be provided to
indicate the IP addresses where these services are running:
## Development

AMON_IP
CA_IP
CNAPI_IP
UFDS_IP
VMAPI_IP
NAPI_IP
PAPI_IP
Before commit, ensure that the following checks are clean:

Of course, you provide each one of these environment variables to the proper
test suite make command and, in case you plan to run `make test`, i.e, all the
test suites, you may want to provide all these environment variables.
make prepush

Also, note that `amon` test suite requires the UUID of a real machine to be
given as environment variable in order to be able to create real machine
probes (`MACHINE_UUID` env var).
Also see the note at the top that cr.joyent.us is used for code review for
this repo.

Given UFDS, CNAPI, NAPI and VMAPI are services provided by the default headnode
core zones, if the associated IP env variables are not provided, the test
suites will set them to the default values into a COAL image running the
headnode; that is:

CNAPI_IP=10.99.99.18
UFDS_IP=10.99.99.14
VMAPI_IP=10.99.99.22
NAPI_IP=10.99.99.10
AMON_IP=10.99.99.20
CA_IP=10.99.99.25
PAPI_IP=10.99.99.30
## Releases

There are no default values pointing to the headnode zones for AMON and CA.
The default test values for these APIs point to `localhost` so, you may want
to either run them locally or pass in the values for these zones IPs.
Changes with possible user impact should:

So, in brief, requirements to run these test suites:
1. Add a note to the changelog (CHANGES.md).
2. Bump the package version appropriately.
3. Once merged to master, the new version should be tagged and published to npm
via:

- Headnode setup, including AMON and CA zones.
- Run the following command:
make cutarelease

CNAPI_IP=10.99.99.18 \
VMAPI_IP=10.99.99.22 \
UFDS_IP=10.99.99.14 \
NAPI_IP=10.99.99.10 \
CA_IP=10.99.99.25 \
AMON_IP=10.99.99.20 \
PAPI_IP=10.99.99.30 \
MACHINE_UUID=f56dbb40-1c81-4047-9d56-73fc3adf2b99 \
make test
To list to npm accounts that have publish access:

with the different IP env vars pointing to the right IP for each zone.
npm owner ls sdc-clients

Note that it's also possible to pass the ENV variable `ADMIN_PWD` to be used
with UFDS authentication tests. When not given, it will default to the
_traditional_ `joypass123`.
The desire is that users of this package use published versions in their
package.json `dependencies`, rather than depending on git shas.

0 comments on commit 9b4d4a3

Please sign in to comment.