Compare commits
2 commits
8c7f93c1a0
...
ab014c10a3
Author | SHA1 | Date | |
---|---|---|---|
Kegan Myers | ab014c10a3 | ||
Kegan Myers | 3eeb15609a |
|
@ -3,7 +3,12 @@ WORKDIR /app
|
|||
FROM base as packages
|
||||
ADD package.json yarn.lock /app/
|
||||
RUN yarn --production --frozen-lockfile
|
||||
FROM base as final
|
||||
FROM base as src
|
||||
COPY --from="packages" /app/node_modules /app/node_modules
|
||||
ADD . /app
|
||||
FROM src as test
|
||||
RUN yarn && \
|
||||
node lib/binaryQuerystring/index.test.js
|
||||
FROM src as final
|
||||
CMD node index.js
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: '${NAMESPACE}'
|
||||
spec: {}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
|
@ -77,4 +71,3 @@ spec:
|
|||
backend:
|
||||
serviceName: '${APP_NAME}'
|
||||
servicePort: http
|
||||
|
||||
|
|
43
integration.js
Normal file
43
integration.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
const assert = require('assert');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const infoHash = '(m.%5bO%83i%85S(3j%c1%26%3a%e0*z%60%d5';
|
||||
(async () => {
|
||||
if (!process.env.ENDPOINT) {
|
||||
throw new Error('Endpoint must be defined.');
|
||||
}
|
||||
console.log(`testing ${process.env.ENDPOINT} with infoHash '${infoHash}'`);
|
||||
|
||||
const res = await fetch(
|
||||
`${process.env.ENDPOINT}/fetch?info_hash=${infoHash}&json=1`,
|
||||
);
|
||||
assert.deepEqual(res.status, 200, 'expected response to be ok');
|
||||
|
||||
const data = await res.json();
|
||||
assert.deepEqual(
|
||||
typeof data,
|
||||
'object',
|
||||
'expected response to be an array (is not an object)',
|
||||
);
|
||||
assert.ok(
|
||||
data instanceof Array,
|
||||
'expected response to be an array (is not an object)',
|
||||
);
|
||||
assert.ok(data.length > 0, 'expected popular torrent to have peers');
|
||||
data.forEach((peer) => {
|
||||
assert.deepEqual(
|
||||
typeof peer,
|
||||
'string',
|
||||
'expected every response entry to be a string',
|
||||
);
|
||||
assert.match(
|
||||
peer,
|
||||
/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/,
|
||||
'expected every response entry to resemble ip:port',
|
||||
);
|
||||
});
|
||||
})().catch((e) => {
|
||||
console.log(e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
Loading…
Reference in a new issue