node js tests
This commit is contained in:
parent
a4ca9df41b
commit
f1ee23f5fa
26 changed files with 935 additions and 2 deletions
7
Integration/expressjs-testsuite/main.fmf
Normal file
7
Integration/expressjs-testsuite/main.fmf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
summary: Runs internal expressjs tests.
|
||||
description: |
|
||||
Test to verify Express’s compatibility with the Node.js.
|
||||
duration: 5m
|
||||
require:
|
||||
- nodejs
|
||||
- git
|
||||
63
Integration/expressjs-testsuite/runtest.sh
Executable file
63
Integration/expressjs-testsuite/runtest.sh
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: Basic sanity test for express module.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
# Packages to be tested
|
||||
PACKAGES=${PACKAGES:-nodejs nodejs-npm}
|
||||
# Other required packages
|
||||
REQUIRES=${REQUIRES:-git}
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testsuite"
|
||||
rlRun "git clone https://github.com/expressjs/express.git" 0 "Clone the upstream repo with the Express framework"
|
||||
rlRun "pushd express" 0 "Change directory to the express repo directory"
|
||||
|
||||
rlRun "latest_express=$(npm show express version)" 0 "Figuring out what the latest express version is"
|
||||
rlLog "Latest Express version: ${latest_express}"
|
||||
rlRun "git stash" 0 "Stashing eventual changes so they don't prevent checkout"
|
||||
rlRun "git checkout '${latest_express}'" 0 "Checkout git's tag ${latest_express}"
|
||||
rlRun "npm install mocha"
|
||||
rlRun -s "npm test" 0 "Running the test-suite"
|
||||
rlAssertGrep "[0-9]* passing" "$rlRun_LOG" -E
|
||||
rlAssertNotGrep "[0-9]* failing" "$rlRun_LOG" -E
|
||||
rlAssertNotGrep "Test failed" "$rlRun_LOG"
|
||||
rlRun "popd" 0 "Get back to the original directory"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
42
README.md
42
README.md
|
|
@ -1,3 +1,41 @@
|
|||
# nodejs
|
||||
# Node.JS Tests
|
||||
|
||||
Test suite for the nodejs on fedora
|
||||
Nodejs test suite for Fedora Linux
|
||||
|
||||
These tests made for Test Management Tool, using .fmf format for metadata
|
||||
|
||||
[Tmt docs for reference](/https://tmt.readthedocs.io/en/stable/)
|
||||
|
||||
|
||||
|
||||
# Usage locally
|
||||
|
||||
Make sure you got tmt and its tools installed:
|
||||
```bash
|
||||
sudo dnf install -y tmt tmt+provision-virtual
|
||||
```
|
||||
or if you want all tools (virtual and container):
|
||||
```bash
|
||||
sudo dnf install -y tmt+all
|
||||
```
|
||||
check what test plans and sub plans are available:
|
||||
```bash
|
||||
tmt plans
|
||||
```
|
||||
check what individual tests are available:
|
||||
```bash
|
||||
tmt tests
|
||||
```
|
||||
## Run all available tests
|
||||
```bash
|
||||
tmt run
|
||||
```
|
||||
## Run chosen plan or individual test
|
||||
```bash
|
||||
tmt plans
|
||||
tmt run plans -n <plan>
|
||||
```
|
||||
```bash
|
||||
tmt tests
|
||||
tmt run tests -n <test>
|
||||
```
|
||||
|
|
|
|||
10
Sanity/express-testsuite/main.fmf
Normal file
10
Sanity/express-testsuite/main.fmf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
summary: extension fs is installed without error
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
description: |
|
||||
Test ensures that extension fs is installed without errors.
|
||||
duration: 5m
|
||||
recommend: nodejs
|
||||
require:
|
||||
- nodejs
|
||||
tier: '1'
|
||||
62
Sanity/express-testsuite/runtest.sh
Executable file
62
Sanity/express-testsuite/runtest.sh
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
# Packages to be tested
|
||||
PACKAGES=${PACKAGES:-nodejs nodejs-npm}
|
||||
# Other required packages
|
||||
REQUIRES=${REQUIRES:-git}
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testsuite"
|
||||
rlRun "git clone https://github.com/expressjs/express.git" 0 "Clone the upstream repo with the Express framework"
|
||||
rlRun "pushd express" 0 "Change directory to the express repo directory"
|
||||
|
||||
rlRun "latest_express=$(npm show express version)" 0 "Figuring out what the latest express version is"
|
||||
rlRun "npm install mocha"
|
||||
rlLog "Latest Express version: ${latest_express}"
|
||||
rlRun "git stash" 0 "Stashing eventual changes so they don't prevent checkout"
|
||||
rlRun "git checkout '${latest_express}'" 0 "Checkout git's tag ${latest_express}"
|
||||
|
||||
rlRun -s "npm test" 0 "Running the test-suite"
|
||||
rlAssertGrep "[0-9]* passing" "$rlRun_LOG" -E
|
||||
rlAssertNotGrep "[0-9]* failing" "$rlRun_LOG" -E
|
||||
rlAssertNotGrep "Test failed" "$rlRun_LOG"
|
||||
rlRun "popd" 0 "Get back to the original directory"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
7
Sanity/http-smoke/main.fmf
Normal file
7
Sanity/http-smoke/main.fmf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
summary: Basic server running.
|
||||
description: |
|
||||
Test ensures that nodejs can import http module and run basic http server.
|
||||
duration: 5m
|
||||
require:
|
||||
- nodejs
|
||||
component: nodejs
|
||||
97
Sanity/http-smoke/runtest.sh
Executable file
97
Sanity/http-smoke/runtest.sh
Executable file
|
|
@ -0,0 +1,97 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
# Packages to be tested
|
||||
PACKAGES=${PACKAGES:-nodejs}
|
||||
# Other required packages
|
||||
REQUIRES=${REQUIRES:-curl}
|
||||
# Binary name parametrized
|
||||
NODEJS=${NODEJS:-node}
|
||||
|
||||
# Port range for server to choose from
|
||||
MIN_SERVER_PORT=${MIN_SERVER_PORT:-8000}
|
||||
MAX_SERVER_PORT=${MAX_SERVER_PORT:-8080}
|
||||
|
||||
# Actual server port to use
|
||||
SERVER_PORT=${SERVER_PORT:-8008}
|
||||
|
||||
# Time delay for server to start and for curl to download
|
||||
SLEEP_TIME=${SLEEP_TIME:-10}
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlAssertBinaryOrigin $NODEJS
|
||||
|
||||
port_chosen=false
|
||||
rlLogInfo "Choosing server port..."
|
||||
for port in $(seq ${MIN_SERVER_PORT} 1 ${MAX_SERVER_PORT}); do
|
||||
if ! fuser ${port}/tcp >/dev/null 2>&1; then
|
||||
SERVER_PORT=${port}
|
||||
port_chosen=true
|
||||
rlLogInfo "\"${SERVER_PORT}\" chosen"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
$port_chosen || rlLogWarning "No port available from a given range \"${MIN_SERVER_PORT}\" - \"${MAX_SERVER_PORT}\". Using \"${SERVER_PORT}\" anyway."
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp server.js $TmpDir/." 0 "Copying server source file"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
echo "---node-processes--"
|
||||
ps -e | grep node
|
||||
echo "---"
|
||||
|
||||
rlRun "${NODEJS} server.js ${SERVER_PORT} 2>&1 > server_out &" 0 "Running server and logging output"
|
||||
rlRun "sleep ${SLEEP_TIME}" 0 "Giving server \"${SLEEP_TIME}\" seconds to start"
|
||||
rlRun "curl --max-time ${SLEEP_TIME} http://127.0.0.1:${SERVER_PORT} > curl_out && cat curl_out" 0 "Querying server"
|
||||
rlRun "grep 'Hello World' curl_out" 0 "Response should contain \"Hello World\""
|
||||
rlRun "kill $!" 0 "Stopping the server"
|
||||
sleep 1
|
||||
rlRun "ps -e | grep $!" 1 "Server should not be running"
|
||||
|
||||
echo "---server-output--"
|
||||
cat server_out
|
||||
echo "---"
|
||||
|
||||
rlRun "grep 'Request received.' server_out" 0 "Output should contain \"Request received.\""
|
||||
rlRun "grep 'Server has started.' server_out" 0 "Output should contain \"Server has started.\""
|
||||
rlRun "kill -SIGKILL $!" 0,1 "Attempt killing possibly leftover server process"
|
||||
|
||||
echo "---node-processes-and-directory-contents--"
|
||||
ps -e | grep node
|
||||
ls -lah
|
||||
echo "---"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
18
Sanity/http-smoke/server.js
Normal file
18
Sanity/http-smoke/server.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// server.js -- minimal node.js http server
|
||||
// Usage: node server.js [PORT]
|
||||
// Default port is 8000
|
||||
|
||||
var http = require("http");
|
||||
var port = process.argv[2] || 8000;
|
||||
|
||||
function onRequest(request, response) {
|
||||
console.log("Request received.");
|
||||
response.writeHead(200, {"Content-Type": "text/plain"});
|
||||
response.write("Hello World\n");
|
||||
response.end();
|
||||
}
|
||||
|
||||
http.createServer(onRequest).listen(port);
|
||||
|
||||
console.log("Server has started.");
|
||||
|
||||
10
Sanity/install-expo/main.fmf
Normal file
10
Sanity/install-expo/main.fmf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
summary: extension fs is installed without error
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
description: |
|
||||
Test ensures that extension fs is installed without errors.
|
||||
duration: 5m
|
||||
recommend: nodejs
|
||||
require:
|
||||
- nodejs
|
||||
tier: '1'
|
||||
50
Sanity/install-expo/runtest.sh
Executable file
50
Sanity/install-expo/runtest.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: Basic sanity test for express module.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
NPMJS=${NPMJS:-npm}
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "pushd $tmp"
|
||||
rlPhaseEnd
|
||||
#Test an installation and usage of expo
|
||||
rlPhaseStartTest
|
||||
rlRun "$NPMJS install -g expo" 0
|
||||
rlRun "$NPMJS list -g expo" 0
|
||||
rlRun "npx create-expo-app my-app -y" 0
|
||||
rlRun "cd my-app && npx expo start --port 19000 &" 0 "starting server"
|
||||
rlRun "sleep 10" 0
|
||||
rlRun "curl http://localhost:19000" 0
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlLogInfo "Deleting files created by npm install"
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $tmp" 0 "Remove tmp directory"
|
||||
rlPhaseEnd
|
||||
|
||||
rlJournalEnd
|
||||
|
||||
4
Sanity/nodejs-smoke/main.fmf
Normal file
4
Sanity/nodejs-smoke/main.fmf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
summary: Basic nodejs smoke test using beakerlib framework.
|
||||
component: nodejs
|
||||
require:
|
||||
- nodejs
|
||||
44
Sanity/nodejs-smoke/runtest.sh
Executable file
44
Sanity/nodejs-smoke/runtest.sh
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: Basic smoke tests for nodejs.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "pushd $tmp"
|
||||
rlRun "set -o pipefail"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "node -v" 0 "Check Node Version"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $tmp" 0 "Remove tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
||||
11
Sanity/npm-install/main.fmf
Normal file
11
Sanity/npm-install/main.fmf
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
summary: extension fs is installed without error
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
description: |
|
||||
Test ensures that extension fs is installed without errors.
|
||||
duration: 5m
|
||||
recommend: nodejs
|
||||
require:
|
||||
- nodejs
|
||||
- gcc
|
||||
tier: '1'
|
||||
56
Sanity/npm-install/runtest.sh
Executable file
56
Sanity/npm-install/runtest.sh
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: Basic sanity test for npm install.
|
||||
#
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
TEST_USER="nodeuser"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "pushd $tmp"
|
||||
rlRun "set -o pipefail"
|
||||
id $TEST_USER && rlRun "userdel -r $TEST_USER"
|
||||
rlRun "useradd $TEST_USER" 0 "Adding user '$TEST_USER' to the system"
|
||||
rlRun "chown -R $TEST_USER:$TEST_USER $tmp" 0 "$TEST_USER can (un)install npm in $tmp"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "su -c 'npm install fs' $TEST_USER" 0 "Try to install fs with npm under $TEST_USER"
|
||||
rlPhaseEnd
|
||||
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlLogInfo "Deleting files created by npm install"
|
||||
su -c 'set -o pipefail; npm config get cache | xargs rm -rf' $TEST_USER || \
|
||||
su -c 'set -o pipefail; npm config list | grep "cache" | awk -F "=" '"'"'{print $2}'"'"' | xargs rm -rf' $TEST_USER
|
||||
rlRun "userdel -r $TEST_USER"
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $tmp" 0 "Remove tmp directory"
|
||||
rlPhaseEnd
|
||||
|
||||
rlJournalEnd
|
||||
|
||||
|
||||
9
Sanity/npm-smoke/_package.json
Normal file
9
Sanity/npm-smoke/_package.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name" : "testpackage",
|
||||
"description" : "This is fake package for testing only.",
|
||||
"version" : "0.0.1",
|
||||
"private": true,
|
||||
"dependencies" : {
|
||||
"optimist" : "=0.4.0"
|
||||
}
|
||||
}
|
||||
13
Sanity/npm-smoke/main.fmf
Normal file
13
Sanity/npm-smoke/main.fmf
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
summary: extension fs is installed without error
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
description: |
|
||||
Test ensures that extension fs is installed without errors.
|
||||
duration: 5m
|
||||
recommend:
|
||||
- nodejs
|
||||
- nodejs-npm
|
||||
require:
|
||||
- nodejs
|
||||
- nodejs-npm
|
||||
tier: '1'
|
||||
126
Sanity/npm-smoke/runtest.sh
Executable file
126
Sanity/npm-smoke/runtest.sh
Executable file
|
|
@ -0,0 +1,126 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
function check_and_cleanup()
|
||||
{
|
||||
rlAssertExists "./node_modules/optimist/package.json"
|
||||
rlRun "[[ -e './node_modules/optimist/node_modules/wordwrap/package.json' ]] || [[ -e './node_modules/wordwrap/package.json' ]]" 0 "File wordwrap/package.json should exist."
|
||||
# Skip directory cleanup if the first parameter is empty
|
||||
[[ -z "$1" ]] && rlRun "rm -rf ./node_modules && ! ls ./node_modules" 0 "Cleaning up local modules"
|
||||
rlRun "$NPMJS cache clean --force" 0 "Cleaning up npm cache"
|
||||
}
|
||||
|
||||
|
||||
# Packages to be tested
|
||||
PACKAGES=${PACKAGES:-nodejs}
|
||||
# Other required packages
|
||||
REQUIRES=${REQUIRES:-}
|
||||
# Node binary name parametrized
|
||||
NODEJS=${NODEJS:-node}
|
||||
# NPM binary name parametrized
|
||||
NPMJS=${NPMJS:-npm}
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlAssertBinaryOrigin $NODEJS
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp *.js* $TmpDir/." 0 "Copying additional test files"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Install"
|
||||
echo "---ls--" && ls -lah && echo "--- " # info
|
||||
|
||||
# Tests
|
||||
rlLog "Installing from web repository:"
|
||||
rlRun "$NPMJS install optimist " 0 "Installing \"optimist\" from repository"
|
||||
check_and_cleanup
|
||||
|
||||
rlLog "Installing using \"package.json\" and web repository:"
|
||||
rlRun "mv _package.json package.json" 0 "Enabling \"package.json\""
|
||||
rlRun "$NPMJS install" 0 "Installing \"optimist\" using \"package.json\""
|
||||
check_and_cleanup
|
||||
rlRun "mv package.json _package.json" 0 "Disabling \"package.json\""
|
||||
|
||||
rlLog "Installing particular version from web repository:"
|
||||
rlRun "$NPMJS install optimist@0.4.0" 0 "Installing version 0.4.0 of \"optimist\""
|
||||
check_and_cleanup
|
||||
|
||||
rlLog "Installing globally from web repository:"
|
||||
rlRun "$NPMJS install coffee-script --global " 0 "Installing \"coffee-script\" globally"
|
||||
rlRun "which coffee" 0 "Executable \"coffee\" should be in binary path"
|
||||
rlRun "$NPMJS cache clean --force" 0 "Cleaning up npm cache"
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Remove"
|
||||
rlLog "Removing local package:"
|
||||
rlRun "$NPMJS remove optimist wordwrap" 0 "Removing \"optimist\" and \"wordwrap\""
|
||||
rlAssertNotExists "./node_modules/optimist/package.json"
|
||||
rlAssertNotExists "./node_modules/optimist/node_modules/wordwrap/package.json"
|
||||
rlAssertNotExists "./node_modules/wordwrap/package.json"
|
||||
|
||||
echo "---ls-node-modules--" && ls -lah ./node_modules # info
|
||||
echo "---" # info
|
||||
|
||||
rlLog "Removing global package:"
|
||||
rlRun "$NPMJS remove coffee-script --global" 0 "Removing global \"coffee-script\""
|
||||
rlAssertNotExists "${npm_global_path}/coffee-script/package.json"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Help"
|
||||
rlLog "Checking quickhelp messages:"
|
||||
# special treatment for npm test -h (displays man)
|
||||
rlRun "${NPMJS} test -h | col -bx | grep -E '${CHECK_APIHELP_FOR}|${NPMJS} test'"\
|
||||
0 "Calling \"${NPMJS} test -h\" should display quick help or man"
|
||||
run_by_format "${NPMJS} %kword% -h | col -bx | grep -E '${NPMJS} %kword%'"\
|
||||
"$CHECK_QUICKHELP_PAGES" \
|
||||
"Calling \"${NPMJS} %kword% -h\" should display quick help"
|
||||
|
||||
rlLog "Checking help pages (man redirects):"
|
||||
run_by_format "${NPMJS} help %kword% | col -bx | grep -E '${CHECK_HELP_FOR}'" \
|
||||
"$CHECK_HELP_PAGES" \
|
||||
"Calling \"${NPMJS} help %kword%\" should display manpage"
|
||||
|
||||
if ${NPMJS} -h | grep 'apihelp'; then
|
||||
run_by_format "${NPMJS} apihelp %kword% | col -bx | grep -E '${CHECK_APIHELP_FOR}'" \
|
||||
"$CHECK_APIHELP_PAGES" \
|
||||
"Calling \"${NPMJS} apihelp %kword%\" should display manpage"
|
||||
fi
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "rm /root/.npmrc" 0,1
|
||||
rlRun "rm /root/.npm" 0,1
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
|
||||
|
||||
11
Sanity/npm-unit-tests/main.fmf
Normal file
11
Sanity/npm-unit-tests/main.fmf
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
summary: extension fs is installed without error
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
description: |
|
||||
Test ensures that extension fs is installed without errors.
|
||||
duration: 5m
|
||||
recommend: nodejs
|
||||
require:
|
||||
- nodejs
|
||||
- rpm-build
|
||||
tier: '1'
|
||||
72
Sanity/npm-unit-tests/runtest.sh
Executable file
72
Sanity/npm-unit-tests/runtest.sh
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2024 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE=${PACKAGE:-"npm"}
|
||||
REQUIRES=${REQUIRES:-"rpm-build"}
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
|
||||
rlAssertRpm --all
|
||||
rlRun "pushd /root"
|
||||
#Currently running locally against newest version
|
||||
rlRun "rlFetchSrcForInstalled nodejs"
|
||||
rlRun "rpm -ivh ~/nodejs*.src.rpm"
|
||||
rlRun "dnf -y builddep ~/rpmbuild/SPECS/nodejs22.spec"
|
||||
rlRun "rpmbuild -bp ~/rpmbuild/SPECS/nodejs22.spec"
|
||||
|
||||
|
||||
## Installing npm modules needed to test itself
|
||||
rlRun "mkdir modules"
|
||||
rlRun "cd modules"
|
||||
rlRun "npm config set registry https://registry.npmjs.org/"
|
||||
rlRun "npm install tap"
|
||||
rlRun "npm install mock-globals"
|
||||
rlRun "npm install npm-registry-mock"
|
||||
rlRun "cp -r ~/modules/* ~/rpmbuild/BUILD/nodejs22-22.11.0-build/node-v22.11.0/deps/npm/test"
|
||||
rlRun "cd ~/rpmbuild/BUILD/nodejs22-22.11.0-build/node-v22.11.0/deps/npm/test"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "node index.js &> log.out" 0,1 "Run npm unit tests"
|
||||
echo "== log.out ==========="
|
||||
cat log.out
|
||||
echo "==/log.out ==========="
|
||||
|
||||
if [ `node -e "console.log(process.version.split('.')[0].split('v')[1])"` == 16 ]; then
|
||||
rlAssertGrep "{ total: 5, pass: 5 }" log.out
|
||||
else
|
||||
rlAssertGrep "total: 3, pass: 2, fail: 1 " log.out
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "cd ~"
|
||||
rlRun "rm -rf rpmbuild"
|
||||
rlRun "rm -rf nodejs*.src.rpm"
|
||||
rlRun "rm -rf modules"
|
||||
rlRun "popd"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
4
Sanity/run-basic-js-script/main.fmf
Normal file
4
Sanity/run-basic-js-script/main.fmf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
summary: Run basic js script
|
||||
recommend:
|
||||
nodejs
|
||||
tier: smoke
|
||||
54
Sanity/run-basic-js-script/runtest.sh
Executable file
54
Sanity/run-basic-js-script/runtest.sh
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: Basic sanity test for running a JavaScript.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
TEST_USER="nodeuser"
|
||||
JS_FILE="$tmp/test-script.js"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "pushd $tmp"
|
||||
rlRun "set -o pipefail"
|
||||
id $TEST_USER && rlRun "userdel -r $TEST_USER"
|
||||
rlRun "useradd $TEST_USER" 0 "Adding user '$TEST_USER' to the system"
|
||||
rlRun "chown -R $TEST_USER:$TEST_USER $tmp" 0 "$TEST_USER can (un)install modules in $tmp"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "node -v" 0 "Check Node Version"
|
||||
# Create the JavaScript file
|
||||
rlRun "echo 'console.log(\"Hello from BeakerLib!\");' > $JS_FILE" 0 "Create JavaScript file"
|
||||
rlRun "node $JS_FILE > out.log" 0 "Run basic script and output into log file"
|
||||
rlAssertGrep "Hello from BeakerLib!" out.log
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "userdel -r $TEST_USER"
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $tmp" 0 "Remove tmp directory"
|
||||
rlRun "rm -f $JS_FILE" 0 "Remove JavaScript file"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
||||
10
Sanity/smoke/main.fmf
Normal file
10
Sanity/smoke/main.fmf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
summary: extension fs is installed without error
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
description: |
|
||||
Test ensures that extension fs is installed without errors.
|
||||
duration: 5m
|
||||
recommend: nodejs
|
||||
require:
|
||||
- nodejs
|
||||
tier: '1'
|
||||
98
Sanity/smoke/runtest.sh
Executable file
98
Sanity/smoke/runtest.sh
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
#!/bin/bash
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
# Packages to be tested
|
||||
PACKAGES=${PACKAGES:-nodejs}
|
||||
# Other required packages
|
||||
REQUIRES=${REQUIRES:-curl}
|
||||
# Binary name parametrized
|
||||
NODEJS=${NODEJS:-node}
|
||||
|
||||
# Port range for server to choose from
|
||||
MIN_SERVER_PORT=${MIN_SERVER_PORT:-8000}
|
||||
MAX_SERVER_PORT=${MAX_SERVER_PORT:-8080}
|
||||
|
||||
# Actual server port to use
|
||||
SERVER_PORT=${SERVER_PORT:-8008}
|
||||
|
||||
# Time delay for server to start and for curl to download
|
||||
SLEEP_TIME=${SLEEP_TIME:-10}
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlAssertBinaryOrigin $NODEJS
|
||||
|
||||
# Try to choose port from a port range
|
||||
port_chosen=false
|
||||
rlLogInfo "Choosing server port..."
|
||||
for port in $(seq ${MIN_SERVER_PORT} 1 ${MAX_SERVER_PORT}); do
|
||||
if ! fuser ${port}/tcp >/dev/null 2>&1; then
|
||||
SERVER_PORT=${port}
|
||||
port_chosen=true
|
||||
rlLogInfo "\"${SERVER_PORT}\" chosen"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Warn if port was not chosen from a port range
|
||||
$port_chosen || rlLogWarning "No port available from a given range \"${MIN_SERVER_PORT}\" - \"${MAX_SERVER_PORT}\". Using \"${SERVER_PORT}\" anyway."
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp server.js $TmpDir/." 0 "Copying server source file"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
echo "---node-processes--"
|
||||
ps -e | grep node
|
||||
echo "---"
|
||||
|
||||
rlRun "${NODEJS} server.js ${SERVER_PORT} 2>&1 > server_out &" 0 "Running server and logging output"
|
||||
rlRun "sleep ${SLEEP_TIME}" 0 "Giving server \"${SLEEP_TIME}\" seconds to start"
|
||||
rlRun "curl --max-time ${SLEEP_TIME} http://127.0.0.1:${SERVER_PORT} > curl_out && cat curl_out" 0 "Querying server"
|
||||
rlRun "grep 'Hello World' curl_out" 0 "Response should contain \"Hello World\""
|
||||
rlRun "kill $!" 0 "Stopping the server"
|
||||
sleep 1
|
||||
rlRun "ps -e | grep $!" 1 "Server should not be running"
|
||||
|
||||
echo "---server-output--"
|
||||
cat server_out
|
||||
echo "---"
|
||||
|
||||
rlRun "grep 'Request received.' server_out" 0 "Output should contain \"Request received.\""
|
||||
rlRun "grep 'Server has started.' server_out" 0 "Output should contain \"Server has started.\""
|
||||
rlRun "kill -SIGKILL $!" 0,1 "Attempt killing possibly leftover server process"
|
||||
|
||||
echo "---node-processes-and-directory-contents--"
|
||||
ps -e | grep node
|
||||
ls -lah
|
||||
echo "---"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
18
Sanity/smoke/server.js
Normal file
18
Sanity/smoke/server.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// server.js -- minimal node.js http server
|
||||
// Usage: node server.js [PORT]
|
||||
// Default port is 8000
|
||||
|
||||
var http = require("http");
|
||||
var port = process.argv[2] || 8000;
|
||||
|
||||
function onRequest(request, response) {
|
||||
console.log("Request received.");
|
||||
response.writeHead(200, {"Content-Type": "text/plain"});
|
||||
response.write("Hello World\n");
|
||||
response.end();
|
||||
}
|
||||
|
||||
http.createServer(onRequest).listen(port);
|
||||
|
||||
console.log("Server has started.");
|
||||
|
||||
5
main.fmf
Normal file
5
main.fmf
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# This metadata will be applied to each test case
|
||||
contact: Tomas Juhasz <tjuhasz@redhat.com> Andrei Radchenko <aradchen@redhat.com>
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
|
||||
36
plans.fmf
Normal file
36
plans.fmf
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Root plan: Defines common metadata
|
||||
/:
|
||||
# To not inherit anything from some tests 'above'?
|
||||
inherit: false
|
||||
|
||||
# This will apply to each sub-plans below
|
||||
execute:
|
||||
how: tmt
|
||||
|
||||
# Subplan: Run all the tests
|
||||
/all:
|
||||
summary: Run all Node.js tests.
|
||||
discover:
|
||||
how: fmf
|
||||
# You probably dont want to run all TCs on each commit to this repo.
|
||||
# Still need to figure out where this check happens
|
||||
adjust:
|
||||
- when: trigger == commit
|
||||
enabled: false
|
||||
|
||||
# Subplan: Run smoke tests only
|
||||
/smoke:
|
||||
summary: Run smoke tests for Node.js.
|
||||
discover:
|
||||
how: fmf
|
||||
filter: "tier:smoke" # Filter tests tagged as smoke tests
|
||||
|
||||
# Subplan: Run extended tests (long-running)
|
||||
/extended:
|
||||
summary: Run extended Node.js tests.
|
||||
discover:
|
||||
how: fmf
|
||||
filter: "tier:extended" # Filter tests tagged as extended
|
||||
adjust:
|
||||
- when: environment == production
|
||||
enabled: false # Disable extended tests in production environments
|
||||
Loading…
Add table
Add a link
Reference in a new issue