Skip to content

Commit aac7300

Browse files
committed
test: new tests setup with Docker
1 parent 65b5123 commit aac7300

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

test.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM public.ecr.aws/shelf/lambda-libreoffice-base:7.3-node16-x86_64
2+
3+
COPY . ${LAMBDA_TASK_ROOT}/
4+
CMD [ "test.handler" ]

test.js renamed to test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
const {writeFileSync} = require('fs');
33
const {convertTo} = require('./lib');
44

5-
module.exports.handler = async () => {
5+
module.exports.handler = () => {
66
writeFileSync('/tmp/test.txt', Buffer.from('Hello World!'));
77

8-
const extensionOptions = {extensions: ['test_extension.oxt']};
8+
const convertedFilePath = convertTo('test.txt', `pdf`);
99

10-
return convertTo('test.txt', `"pdf:writer_pdf_Export"`, extensionOptions);
10+
console.log({convertedFilePath});
1111
};

test/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
cp -r ../lib ./
4+
cp -r ../node_modules ./
5+
docker build -t lo-lambda-test .
6+
7+
(sleep 7; curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}') &
8+
(sleep 30; CID=$(cat ./cid) && docker stop $CID && rm ./cid) &
9+
10+
docker run -p 9000:8080 --rm --cidfile ./cid lo-lambda-test

test_extension.oxt

-855 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)