-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reporting integration tests and EDP simulator tests (#1423)
* Extracted the common code of sampling VIDs to a function `sampleVids`. Affected files: * src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt * src/main/kotlin/org/wfanet/measurement/loadtest/measurementconsumer/MeasurementConsumerSimulator.kt * src/main/kotlin/org/wfanet/measurement/integration/common/reporting/v2/InProcessLifeOfAReportIntegrationTest.kt * Computed expected values by VIDs instead of hardcoded values in EDP simulator tests. * Calculated tolerance for result check using metric variance in reporting integration tests. * Implemented impression metric result check in the reporting integration tests. * Fixed bug in reporting integration tests. Bug lists: * Use one event group to compute expected value when there are two in the reporting set. * The expected value of unique reach in a report is logically incorrect. * Report with cumulative doesn't set cumulative to true. * Added direct reach-only test to src/main/kotlin/org/wfanet/measurement/integration/common/InProcessLifeOfAMeasurementIntegrationTest.kt
- Loading branch information
Showing
11 changed files
with
608 additions
and
651 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
940 changes: 369 additions & 571 deletions
940
...anet/measurement/integration/common/reporting/v2/InProcessLifeOfAReportIntegrationTest.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/kotlin/org/wfanet/measurement/loadtest/common/SampleVids.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2024 The Cross-Media Measurement Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.wfanet.measurement.loadtest.common | ||
|
||
import com.google.protobuf.Message | ||
import org.wfanet.measurement.loadtest.config.VidSampling | ||
import org.wfanet.measurement.loadtest.dataprovider.EventQuery | ||
|
||
fun sampleVids( | ||
eventQuery: EventQuery<Message>, | ||
eventGroupSpecs: Iterable<EventQuery.EventGroupSpec>, | ||
vidSamplingIntervalStart: Float, | ||
vidSamplingIntervalWidth: Float, | ||
): Iterable<Long> { | ||
require(vidSamplingIntervalWidth > 0 && vidSamplingIntervalWidth <= 1.0) { | ||
"Invalid vidSamplingIntervalWidth $vidSamplingIntervalWidth" | ||
} | ||
require( | ||
vidSamplingIntervalStart < 1 && | ||
vidSamplingIntervalStart >= 0 && | ||
vidSamplingIntervalWidth > 0 && | ||
vidSamplingIntervalStart + vidSamplingIntervalWidth <= 1 | ||
) { | ||
"Invalid vidSamplingInterval: start = $vidSamplingIntervalStart, width = " + | ||
"$vidSamplingIntervalWidth" | ||
} | ||
|
||
return eventGroupSpecs | ||
.asSequence() | ||
.flatMap { eventQuery.getUserVirtualIds(it) } | ||
.filter { vid -> | ||
VidSampling.sampler.vidIsInSamplingBucket( | ||
vid, | ||
vidSamplingIntervalStart, | ||
vidSamplingIntervalWidth, | ||
) | ||
} | ||
.asIterable() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.