Welcome to the Linux Foundation Forum!

Lab 9. Continuous Testing - Integrating E2E Tests with Jenkins

I've followed the labs and I experience weird results:

When I run it in my terminal it works correctly, new votes count is always one more than current votes count. But when running it in the Jenkins job it says Current Votes Count: 1 and then **New Votes Count: 4

**E2E tests doesn't work and they doesn't fail the Jenkins job

  1. -----------------
  2. Current Votes Count: 1
  3. -----------------
  4.  
  5. I: Submitting one more vote...
  6.  
  7. Not NULL
  8.  
  9.  
  10. -----------------
  11. New Votes Count: 4
  12. -----------------
  13.  
  14. I: Checking if votes tally......
  15.  
  16. [41m------------
  17. [91mTests failed
  18. [41m------------
  19.  
  20. ...
  21.  
  22. Finished: SUCCESS

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Comments

  • Looks some delay was needed in the e2e.sh script, manually I was way slower than the script and I couldn't reproduce it

    1. #!/bin/bash
    2.  
    3. cd e2e
    4.  
    5. docker-compose down > /dev/null 2>&1
    6.  
    7. #sleep 10
    8.  
    9. docker-compose build
    10. docker-compose up -d
    11.  
    12. sleep 10
    13.  
    14. docker-compose ps
    15.  
    16. docker-compose run --rm e2e
    17.  
    18. docker-compose down

    But still why the job finished with success even when E2E test failed?

  • Posts: 12

    Hey @kzwolenik that's a good question! The jenkins build should have failed when reaching that branch of the if case:

    1. if [ "$next" -eq "$new" ]; then
    2. echo -e "\\e[42m------------"
    3. echo -e "\\e[92mTests passed"
    4. echo -e "\\e[42m------------"
    5. exit 0
    6. else
    7. echo -e "\\e[41m------------"
    8. echo -e "\\e[91mTests failed"
    9. echo -e "\\e[41m------------"
    10. exit 1
    11. fi

    I'd assume that when the script returns exit 1 the job would fail too.
    Were you able to reproduce since you fixed the other issue?

  • Posts: 1,265

    Hi @kzwolenik, what happened in the previous section, when you had to start the containers by hand, using:

    docker compose build

    and

    docker compose up -d

    If that worked, the next section should work.

    Regards,
    Luis.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training