Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Quarantined tests for two build plans?

Is their a way to have quarantined tests for one build plan auto populated to another? We have essentially two Main build plans. One is used for offshore work that gets merged back to the primary daily.  At any given time we have 10-20 quarantined tests coming and going that we would like to be mimicked in the secondary project build plan without having to manually keep them in sync.

1 answer

0 votes

Hi @tdzarnes

Is their a way to have quarantined tests for one build plan auto populated to another?

Bamboo does not have an out-of-the-box feature for this.


We have essentially two Main build plans. One is used for offshore work that gets merged back to the primary daily. At any given time we have 10-20 quarantined tests coming and going that we would like to be mimicked in the secondary project build plan without having to manually keep them in sync.

I totally get your scenario, thank you for explaining it. I'll share what I have and hope that this allows you to move forward.
Bamboo has a rest API to add tests to quarantine, this is the one:

curl -u <USER>:<PASSWORD> \
-H 'Content-Type: application/json' -d{} \
-X POST http://<BAMBOO-URL>/rest/api/latest/plan/COM-TO/test/<TEST-CASE-ID>/quarantine

You will notice that you will need to get the <TEST-CASE-ID> for each one of the tests that you want to put in quarantine. There are two problems here:

  1. There is no REST endpoint to provide you with the <TEST-CASE-ID> at the moment due to this bug: https://jira.atlassian.com/browse/BAM-19816
  2. The test can be exactly the same in both plans but you will have different ids for them.

In order to workaround this I was able to build a query that will show the equivalence of each test considering the test class and test name in both plans.
This is the one:
⚠️It was designed for Postgres DB. In case your DB is different, please update it accordingly.

WITH 
        plan1_tests AS
        (SELECT *        
         FROM build b
         JOIN test_class tcl ON tcl.plan_id=b.build_id
         JOIN test_case tc   ON tc.test_class_id=tcl.test_class_id
         WHERE b.full_key like 'PROJ-PLAN1%'),

        plan2_tests AS
        (SELECT *
         FROM build b
         JOIN test_class tcl ON tcl.plan_id=b.build_id
         JOIN test_case tc   ON tc.test_class_id=tcl.test_class_id
         WHERE b.full_key like 'PROJ-PLAN2%')

SELECT p1.test_class_name,
       p1.test_case_name,
       p1.full_key AS p1_full_key,
       p1.test_case_id AS p1_test_case_id,
       CASE WHEN p1.quarantine_date IS NOT NULL THEN '---YES---' ELSE '---NO---' END AS p1_quarantined,
       p2.full_key AS p2_full_key,
       p2.test_case_id AS p2_test_case_id,
       CASE WHEN p2.quarantine_date IS NOT NULL THEN '---YES---' ELSE '---NO---' END AS p2_quarantined
FROM   plan1_tests p1
JOIN   plan2_tests p2 ON (p1.test_class_name=p2.test_class_name AND p1.test_case_name=p2.test_case_name)
WHERE  p1.quarantine_date IS NOT NULL OR p2.quarantine_date IS NOT NULL

The query should show you only the tests that are quarantined in any of those plans. It could be in the first one, the second one or both. With some programming skills, you should be able to make a script to get these details from the Bamboo DB and run a couple of REST APIs to adjust one plan based on the other one.

I hope it helps.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

223 views 4 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you