Skip to content

Commit

Permalink
test: fix a flaky test (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler authored Jan 13, 2025
1 parent bc0aff2 commit fc1eec7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AudioClassifierTest
private const string _ResourcePath = "Packages/com.github.homuler.mediapipe/PackageResources/MediaPipe";
private const string _TestResourcePath = "Packages/com.github.homuler.mediapipe/Tests/Resources";

private const int _CallbackTimeoutMillisec = 1000;
private const int _CallbackTimeoutMillisec = 2000;

private static readonly IResourceManager _ResourceManager = new LocalResourceManager();
private readonly Lazy<TextAsset> _audioClassifierModel =
Expand Down Expand Up @@ -298,11 +298,11 @@ void callback(ClassificationResult classificationResult, long timestamp)
stopwatch.Start();
yield return new WaitUntil(() =>
{
// wait for the callback to be invoked at least twice
return invokeCount > 1 || stopwatch.ElapsedMilliseconds > _CallbackTimeoutMillisec;
// wait for the callback to be invoked 3 times
return invokeCount > 2 || stopwatch.ElapsedMilliseconds > _CallbackTimeoutMillisec;
});

Assert.IsTrue(invokeCount > 1);
Assert.IsTrue(invokeCount > 2);
Assert.AreEqual(successCount, invokeCount);
}
}
Expand Down

0 comments on commit fc1eec7

Please sign in to comment.