Skip to content
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

add a test for esm #3429

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ onboarding_nodejs:
- ONBOARDING_FILTER_WEBLOG: [test-app-nodejs]
SCENARIO: [CHAOS_INSTALLER_AUTO_INJECTION]
DEFAULT_VMS: ["True", "False"]
- ONBOARDING_FILTER_WEBLOG: [test-app-nodejs-multicontainer]
- ONBOARDING_FILTER_WEBLOG: [test-app-nodejs-multicontainer,test-app-nodejs-esm]
SCENARIO: [SIMPLE_INSTALLER_AUTO_INJECTION]
DEFAULT_VMS: ["True", "False"]
script:
Expand Down
11 changes: 11 additions & 0 deletions lib-injection/build/docker/nodejs/sample-app/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
process.on('SIGTERM', (signal) => {
process.exit(0);
});

import { createServer } from 'http';

createServer((req, res) => {
res.end('Hello, world!\n')
}).listen(18080, () => {
console.log('listening on port 18080') // eslint-disable-line no-console
})
1 change: 1 addition & 0 deletions tests/auto_inject/test_auto_inject_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class TestSimpleInstallerAutoInjectManual(base.AutoInjectBaseTest):
{"vm_branch": "amazon_linux2", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
{"vm_branch": "centos_7_amd64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
{"vm_branch": "redhat", "vm_cpu": "arm64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
{"weblog_variant": "test-app-nodejs-esm", "reason": "INPLAT-136"},
]
)
def test_install(self, virtual_machine):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
weblog:
name: test-app-nodejs-esm
nginx_config: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/nginx.conf
exact_os_branches: [ubuntu24]
install:
- os_type: linux
copy_files:
- name: copy-multicontainer-run-script
local_path: utils/build/virtual_machine/weblogs/common/create_and_run_app_multicontainer.sh
- name: copy-docker-compose-file
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/docker-compose.yml
- name: copy-nodejs-app
local_path: lib-injection/build/docker/nodejs/sample-app
- name: copy-node20-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/Dockerfile.node20
- name: copy-nodejs-app-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/Dockerfile.node
- name: copy-reverseproxy-dockerfile
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/Dockerfile.reverseproxy
- name: copy-reverseproxy-conf
local_path: utils/build/virtual_machine/weblogs/nodejs/test-app-nodejs-esm/nginx.conf
remote-command: sh create_and_run_app_multicontainer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM public.ecr.aws/docker/library/node:20-slim

# Create app directory
WORKDIR /usr/src/app

COPY . .

EXPOSE 18080
CMD [ "node", "index.mjs" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM public.ecr.aws/docker/library/node:20-slim

# Create app directory
WORKDIR /usr/src/app

COPY . .

EXPOSE 18080
CMD [ "node", "index.mjs" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM public.ecr.aws/nginx/nginx:stable-perl

COPY nginx.conf /etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '2'

services:
reverseproxy:
image: reverseproxy:latest
ports:
- 5985:8080
restart: always
build:
context: .
dockerfile: Dockerfile.reverseproxy
healthcheck:
test: "curl -f http://localhost:8080"

node_20:
env_file: "scenario_app.env"
image: system-tests/node_20:latest
restart: always
build:
context: .
dockerfile: Dockerfile.node20
healthcheck:
test: "node health"

node:
env_file: "scenario_app.env"
image: system-tests/node:latest
restart: always
build:
context: .
dockerfile: Dockerfile.node
healthcheck:
test: "node health"
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
worker_processes 1;

events { worker_connections 1024; }

http {

log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $upstream_addr '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';

upstream node_20_app {
server node_20:18080;
}
upstream node_app {
server node:18080;
}

server {
listen 8080;
access_log /var/log/nginx/access.log compression;

location / {
default_type application/json;
return 200 "{
'app_type':'multicontainer',
'apps':[{
'runtime':'20',
'type':'container',
'url':'/node_20/'
},{
'runtime':'latest',
'type':'container',
'url':'/node/'
}]
}";
}

location /node_20/ {
proxy_pass http://node_20_app/;
proxy_redirect off;
}
location /node/ {
proxy_pass http://node_app/;
proxy_redirect off;
}
}
}
Loading