Put API Ip in file to be used later
testing/og-dhcp-API/pipeline/head There was a failure building this commit Details

Pass base_URL as parameter to robotframework
nginx_conf
Nicolas Arenas 2024-10-02 09:23:41 +02:00
parent 7efa997f5f
commit f425f599a7
1 changed files with 8 additions and 2 deletions

View File

@ -45,20 +45,26 @@ pipeline {
sh ''' sh '''
set -e set -e
new_ip=$(vagrant ssh -c "hostname -I" | tr -d '\r\n' | sed 's/^[^0-9]*//' | sed 's/[[:space:]]*$//') new_ip=$(vagrant ssh -c "hostname -I" | tr -d '\r\n' | sed 's/^[^0-9]*//' | sed 's/[[:space:]]*$//')
echo $new_ip > ip.txt
echo "$QINDEL_PASS" | sudo -S bash -c "echo '$new_ip api-test' >> /etc/hosts" echo "$QINDEL_PASS" | sudo -S bash -c "echo '$new_ip api-test' >> /etc/hosts"
echo "IP: $new_ip" echo "IP: $new_ip"
curl -X 'GET' "http://$new_ip/ogdhcp/v1/subnets" -H 'accept: /' curl -X 'GET' "http://$new_ip/ogdhcp/v1/subnets" -H 'accept: /'
''' '''
script {
new_ip = readFile('ip.txt').trim()
}
} }
} }
} }
stage('Run API tests') { stage('Run API tests') {
steps { steps {
dir ('tests/API-dhcp') { dir ('tests/API-dhcp') {
echo 'Running API tests' echo 'Running API tests'
sh ''' sh '''
source robotframework/bin/activate . robotframework/bin/activate
robot -d results/ robot/ robot --variable BASE_URL:http://${new_ip}/ogdhcp/v1 -d results/ robot/
''' '''
} }
// Aquí incluirías los comandos para ejecutar tus pruebas // Aquí incluirías los comandos para ejecutar tus pruebas