Skip to content

Commit

Permalink
increase test time to resolve flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
shangabl committed Jan 5, 2023
1 parent 485672f commit fdaeb65
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ using namespace std;
extern std::string THING_NAME;
extern std::string REGION;

static const int WAIT_TIME = 1000;
static const int INTERVAL = 10;

class TestDeviceDefenderFeature : public ::testing::Test
{
public:
Expand Down Expand Up @@ -62,17 +65,16 @@ TEST_F(TestDeviceDefenderFeature, VerifyViolations)
{
vector<ActiveViolation> violations;
// Check for active violations for 10 minutes 30 seconds. Metrics interval is five minutes.
int maxWaitTime = 630;
const int interval = 30;
int waitTime = WAIT_TIME
while (maxWaitTime > 0)
{
violations = resourceHandler->GetViolations(securityProfileName);
if (violations.size() == metrics.size())
{
break;
}
this_thread::sleep_for(std::chrono::seconds(interval));
maxWaitTime -= interval;
this_thread::sleep_for(std::chrono::seconds(INTERVAL));
maxWaitTime -= INTERVAL;
}

ASSERT_EQ(violations.size(), metrics.size());
Expand Down

0 comments on commit fdaeb65

Please sign in to comment.