From de47bd1575dbf8a9760f77ab1bdad65931aec65e Mon Sep 17 00:00:00 2001 From: semyonsinchenko Date: Sun, 18 Aug 2024 10:04:27 +0200 Subject: [PATCH] Add AD tests On branch main Your branch is up to date with 'origin/main'. Changes to be committed: modified: tsumugi-server/src/test/scala/com/ssinchenko/DeequSuiteBuilderTest.scala --- .../ssinchenko/DeequSuiteBuilderTest.scala | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/tsumugi-server/src/test/scala/com/ssinchenko/DeequSuiteBuilderTest.scala b/tsumugi-server/src/test/scala/com/ssinchenko/DeequSuiteBuilderTest.scala index b123128..bb60554 100644 --- a/tsumugi-server/src/test/scala/com/ssinchenko/DeequSuiteBuilderTest.scala +++ b/tsumugi-server/src/test/scala/com/ssinchenko/DeequSuiteBuilderTest.scala @@ -125,21 +125,21 @@ class DeequSuiteBuilderTest extends AnyFunSuiteLike with BeforeAndAfterAll { ) .build() ) - val size = - DeequSuiteBuilder.parseAnalyzer(proto.Analyzer.newBuilder().setSize(proto.Size.newBuilder().build()).build()) - val sum = DeequSuiteBuilder.parseAnalyzer( + val maxLength = DeequSuiteBuilder.parseAnalyzer( proto.Analyzer .newBuilder() - .setSum( - proto.Sum.newBuilder().setColumn("numViews").build() + .setMaxLength( + proto.MaxLength.newBuilder().setColumn("description").build() ) .build() ) - val maxLength = DeequSuiteBuilder.parseAnalyzer( + val size = + DeequSuiteBuilder.parseAnalyzer(proto.Analyzer.newBuilder().setSize(proto.Size.newBuilder().build()).build()) + val sum = DeequSuiteBuilder.parseAnalyzer( proto.Analyzer .newBuilder() - .setMaxLength( - proto.MaxLength.newBuilder().setColumn("description").build() + .setSum( + proto.Sum.newBuilder().setColumn("numViews").build() ) .build() ) @@ -221,6 +221,36 @@ class DeequSuiteBuilderTest extends AnyFunSuiteLike with BeforeAndAfterAll { .setDoubleExpectation(1.0) ) ) + protoSuiteBuilder.setFileSystemRepository( + proto.VerificationSuite.FileSystemRepository + .newBuilder().setPath("test-file.json") + ) + protoSuiteBuilder.addAnomalyDetections( + proto.AnomalyDetection + .newBuilder() + .setAnalyzer( + proto.Analyzer.newBuilder().setSize(proto.Size.newBuilder().build()) + ) + .setAnomalyDetectionStrategy( + proto.AnomalyDetectionStrategy + .newBuilder() + .setRelativeRateOfChangeStrategy( + proto.RelativeRateOfChangeStrategy + .newBuilder() + .setMaxRateIncrease(1.2) + .setMaxRateDecrease(0.8) + .setOrder(1) + ) + ) + .setConfig( + proto.AnomalyDetection.AnomalyCheckConfig + .newBuilder() + .setLevel(proto.CheckLevel.Warning) + .setDescription("My best description") + .setBeforeDate(1000) + .setAfterDate(0) + ) + ) val deequSuite = DeequSuiteBuilder.protoToVerificationSuite(data, protoSuiteBuilder.build()) val checkResults = deequSuite.run().checkResults