From 9f8f9f8b87f02b8e1df2ba60135bb7863c62520a Mon Sep 17 00:00:00 2001 From: Tomas Juhasz Date: Wed, 8 Jan 2025 12:57:52 +0100 Subject: [PATCH] changes to metadata --- .../npm-integration-global-install/main.fmf | 6 ++-- Integration/run-express-server/main.fmf | 15 ++++++++++ Integration/run-express-server/runtest.sh | 29 +++++++++++++++++++ Integration/run-express-server/server.js | 20 +++++++++++++ Smoke/npm-install-modules/main.fmf | 4 +-- Smoke/upstream-expresss-suite/main.fmf | 8 ++--- plans.fmf | 2 +- 7 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 Integration/run-express-server/main.fmf create mode 100755 Integration/run-express-server/runtest.sh create mode 100644 Integration/run-express-server/server.js diff --git a/Integration/npm-integration-global-install/main.fmf b/Integration/npm-integration-global-install/main.fmf index 998ce49..6e3ddd9 100644 --- a/Integration/npm-integration-global-install/main.fmf +++ b/Integration/npm-integration-global-install/main.fmf @@ -3,10 +3,10 @@ test: ./runtest.sh framework: beakerlib description: | Test ensures that users of various priviliges can access global module. -duration: 5m -recommend: require: -tier: '1' + - nodejs + - npm +tier: 'integration' component: - npm - nodejs diff --git a/Integration/run-express-server/main.fmf b/Integration/run-express-server/main.fmf new file mode 100644 index 0000000..4282787 --- /dev/null +++ b/Integration/run-express-server/main.fmf @@ -0,0 +1,15 @@ +summary: Basic express server test +test: ./runtest.sh +framework: beakerlib +description: | + Test ensures that node and npm can install and run express server. +duration: 10m +require: + - nodejs + - type: file + pattern: + - /server.js +tier: smoke +component: + - npm + - nodejs diff --git a/Integration/run-express-server/runtest.sh b/Integration/run-express-server/runtest.sh new file mode 100755 index 0000000..555c128 --- /dev/null +++ b/Integration/run-express-server/runtest.sh @@ -0,0 +1,29 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "mv server.js $tmp" 0 + rlRun "pushd $tmp" + rlPhaseEnd + + #Test installation and usage of expo + rlPhaseStartTest + rlShowPackageVersion nodejs + rlShowPackageVersion npm + rlRun "npm init -y" + rlRun "npm install express" 0 + rlRun "nohup node server.js &> server.log &" 0 + rlRun "sleep 10" 0 + rlRun "curl http://localhost:55555" 0 "Trying to access server" + rlPhaseEnd + + rlPhaseStartCleanup + rlLogInfo "Deleting files created by npm install" + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd + +rlJournalEnd + diff --git a/Integration/run-express-server/server.js b/Integration/run-express-server/server.js new file mode 100644 index 0000000..9d30d51 --- /dev/null +++ b/Integration/run-express-server/server.js @@ -0,0 +1,20 @@ +const express = require('express'); + +const app = express(); +const PORT = 55555; + +// Middleware example: Log request details +app.use((req, res, next) => { + console.log(`${req.method} ${req.url}`); + next(); +}); + +// Example route +app.get('/', (req, res) => { + res.send('Welcome to the Express server on port 55555!'); +}); + +// Start the server +app.listen(PORT, () => { + console.log(`Server is running on http://localhost:${PORT}`); +}); diff --git a/Smoke/npm-install-modules/main.fmf b/Smoke/npm-install-modules/main.fmf index ecc801f..98c4baa 100644 --- a/Smoke/npm-install-modules/main.fmf +++ b/Smoke/npm-install-modules/main.fmf @@ -3,9 +3,9 @@ test: ./runtest.sh framework: beakerlib description: | Test ensures that npm has the ability to install modules through various means. -duration: 5m -recommend: require: + - npm + - nodejs tier: '1' component: - npm diff --git a/Smoke/upstream-expresss-suite/main.fmf b/Smoke/upstream-expresss-suite/main.fmf index 8dd58cd..aa12677 100644 --- a/Smoke/upstream-expresss-suite/main.fmf +++ b/Smoke/upstream-expresss-suite/main.fmf @@ -3,11 +3,11 @@ test: ./runtest.sh framework: beakerlib description: | Test ensures that NPM implementation can pass upstream test suite. -duration: 5m -recommend: require: - - git -tier: '1' + - git + - nodejs + - npm +tier: 'smoke' component: - npm - nodejs diff --git a/plans.fmf b/plans.fmf index e1b3695..d38dfb0 100644 --- a/plans.fmf +++ b/plans.fmf @@ -3,6 +3,7 @@ discover: how: fmf execute: how: tmt +# Will be overwritten by CI environment: KOJI_BUILD_ID: 123 provision: @@ -12,7 +13,6 @@ prepare: - name: Install test deps how: install package: - - beakerlib - koji - libuv - cpio