Retry Logic when comparing an array value

I have end point where it posts to a service bus queue to lookup value x using value y. This integration can take anything from a few seconds to a 1 minute to complete. What I’m trying to achieve is a retry logic which would retry my GET request for 3 times before failing.

My first test is to be sure that we get a 200

pm.test("Status code is 200", function () {;


I then parse out all of the ID’s into a string and compare to a known value to be sure that the ID for that post exists

responseJson = JSON.parse(responseBody);
var a=[];
var list = (responseJson).length;
for (var i = 0; i < list; i++)

                   var counter = responseJson[i];
a= JSON.stringify(a)

pm.collectionVariables.set("setNoteList", a);
pm.test("Confirm User Note Is Listed", function () {    pm.expect(pm.collectionVariables.get("setNoteList")).to.contain(pm.collectionVariables.get("noteId"));

What i’m looking to do is to somehow have an IF statement in the test function that would retry the GET if the value is false. I have done this before when the value is a simple true or false but i just cannot seem to get the IF statement to work

    pm.test("Confirm User Note Is Listed", function () {


This does not fail but it also does not work and will always pass