Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function start() {
await getStream(await docker.pull(IMAGE));
container = await docker.createContainer({
Tty: true,
Image: IMAGE,
PortBindings: {[`${MOCK_SERVER_PORT}/tcp`]: [{HostPort: `${MOCK_SERVER_PORT}`}]},
});
await container.start();
try {
// Wait for the mock server to be ready
await pRetry(() => got.put(`http://${MOCK_SERVER_HOST}:${MOCK_SERVER_PORT}/status`, {cache: false}), {
retries: 7,
minTimeout: 1000,
factor: 2,
});
} catch (_) {
async function start() {
await getStream(await docker.pull(IMAGE));
container = await docker.createContainer({
Tty: true,
Image: IMAGE,
PortBindings: {[`${COUCHDB_PORT}/tcp`]: [{HostPort: `${SERVER_PORT}`}]},
Env: [`COUCHDB_USER=${COUCHDB_USER}`, `COUCHDB_PASSWORD=${COUCHDB_PASSWORD}`],
});
await container.start();
await delay(4000);
try {
// Wait for the registry to be ready
await pRetry(() => got(`http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app`, {cache: false}), {
retries: 7,
minTimeout: 1000,
cacheableRequest(opts, async response => {
const body = await getStream(response);
response.body = body;
// Give the cache time to update
await delay(100);
resolve(response);
})
.on('request', req => req.end())
it('should work with format and pumpify', async () => {
const query = new Query({ limit: 1 }, { model: user.scope('public') })
const stream = await query.executeStream({
format: json
})
should(stream.contentType).eql(json.contentType)
const res = await collect(pumpify.obj(
stream,
through2()
))
should(typeof res).eql('string')
const parsed = JSON.parse(res)
parsed.length.should.equal(1)
should.not.exist(parsed[0].authToken)
should.exist(parsed[0].name)
})
it('should execute with proper model name', async () => {
test('removing headers', wrapper, async (t, server) => {
const request = makeRequest(server.options);
request.setHeader('foo', 'bar');
request.removeHeader('foo');
request.end();
const res = await pEvent(request, 'response');
const data = JSON.parse(await getStream(res));
t.is(data.headers.foo, undefined);
});
const stringifyContents = function({ contents, execa }) {
if (execa !== undefined) {
return JSON.stringify(execa, null, 2)
}
if (Buffer.isBuffer(contents)) {
return contents.toString()
}
return getStream(contents)
}
cacheableRequest(s.url, async response => {
const body = await getStream(response);
t.is(body, 'hi');
t.end();
}).on('request', req => req.end());
});
const exec = args => {
const cp = spawn(path.resolve(__dirname, 'fixtures', 'cli.es6.js'), args);
cp.stdout.setEncoding('utf8');
cp.stderr.setEncoding('utf8');
return Promise
.all([
getStream(cp.stdout),
getStream(cp.stderr)
.then(res => {
if (res.length > 0) {
throw new Error(res);
}
})
])
.then(([ stdout, stderr ]) => stdout);
};
async function start() {
await getStream(await docker.pull(IMAGE));
container = await docker.createContainer({
Tty: true,
Image: IMAGE,
PortBindings: {[`${SERVER_PORT}/tcp`]: [{HostPort: `${HOST_PORT}`}]},
});
await container.start();
const exec = await container.exec({
Cmd: ['ng-auth', '-u', GIT_USERNAME, '-p', GIT_PASSWORD],
AttachStdout: true,
AttachStderr: true,
});
await exec.start();
}