Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Measurement ConsumerId in EdpSimulator #1067

Merged
merged 7 commits into from
Jun 21, 2023
Merged

Conversation

uakyol
Copy link
Contributor

@uakyol uakyol commented Jun 16, 2023

No description provided.

@uakyol uakyol requested a review from SanjayVas June 16, 2023 01:55
@wfa-reviewable
Copy link

This change is Reviewable

Copy link
Member

@SanjayVas SanjayVas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @uakyol)


src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 388 at r2 (raw file):

    val requisitions =
      getRequisitions().filter {
        MeasurementKey.fromName(it.measurement)!!.measurementConsumerId == measurementConsumerName

This is comparing and ID to a name. Just directly compare it.measurement to measurementConsumerName

@uakyol uakyol requested a review from SanjayVas June 16, 2023 05:33
Copy link
Contributor Author

@uakyol uakyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @SanjayVas)


src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 388 at r2 (raw file):

Previously, SanjayVas (Sanjay Vasandani) wrote…

This is comparing and ID to a name. Just directly compare it.measurement to measurementConsumerName

ah sorry, didn't see your comment and updated based on lifeofameasurement test failing. How about this?

Copy link
Member

@SanjayVas SanjayVas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @uakyol)


src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 388 at r2 (raw file):

Previously, uakyol wrote…

ah sorry, didn't see your comment and updated based on lifeofameasurement test failing. How about this?

Ah, I also made a mistake in my comment. Parse both names to their respective keys, then compare the MC ID fields.

@uakyol uakyol requested a review from SanjayVas June 16, 2023 18:45
Copy link
Contributor Author

@uakyol uakyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @SanjayVas)


src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 388 at r2 (raw file):

Previously, SanjayVas (Sanjay Vasandani) wrote…

Ah, I also made a mistake in my comment. Parse both names to their respective keys, then compare the MC ID fields.

Done.

@uakyol uakyol changed the title For each fetched Requisition, check if it belongs to the Measurement Consumer is correct Check Measurement ConsumerId in EdpSimulator Jun 16, 2023
Copy link
Member

@SanjayVas SanjayVas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @uakyol)


src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 389 at r4 (raw file):

    val requisitions =
      getRequisitions().filter {
        MeasurementKey.fromName(it.measurement)!!.measurementConsumerId ==

nit: Use the appropriate precondition check rather than !!. That operator is for cases where we can guarantee it won't be null, but we just can't prove it to the compiler. There is no code prior to this point that has proven that this value won't be null.

Code quote:

!!

src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 399 at r4 (raw file):

    for (requisition in requisitions) {
      println("requisitionrequisitionrequisitionrequisitionrequisition ${requisition.measurement}")

Use a logger if you need to log something.

Code quote:

println

src/test/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulatorTest.kt line 300 at r4 (raw file):

  fun setup() {
    sketchStore = SketchStore(FileSystemStorageClient(temporaryFolder.root))
  }

Why was this changed? It used to be a @BeforeClass for a JVM static member (and had a more descriptive function name).

Code quote:

  @Before
  fun setup() {
    sketchStore = SketchStore(FileSystemStorageClient(temporaryFolder.root))
  }

@uakyol uakyol requested a review from SanjayVas June 20, 2023 19:26
Copy link
Contributor Author

@uakyol uakyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @SanjayVas)


src/main/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulator.kt line 399 at r4 (raw file):

Previously, SanjayVas (Sanjay Vasandani) wrote…

Use a logger if you need to log something.

sorry, meant to remove


src/test/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulatorTest.kt line 300 at r4 (raw file):

Previously, SanjayVas (Sanjay Vasandani) wrote…

Why was this changed? It used to be a @BeforeClass for a JVM static member (and had a more descriptive function name).

If I do it that way, the test fails with null check failing. Correct me if I am wrong but I think this is because it is initialized once before the class and not before each test case. This causes other test cases to write to that temp folder and those writes being visible to this new test

@uakyol uakyol requested a review from Marco-Premier June 20, 2023 20:49
Copy link
Member

@SanjayVas SanjayVas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r5.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @Marco-Premier and @uakyol)


src/test/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulatorTest.kt line 300 at r4 (raw file):

Previously, uakyol wrote…

If I do it that way, the test fails with null check failing. Correct me if I am wrong but I think this is because it is initialized once before the class and not before each test case. This causes other test cases to write to that temp folder and those writes being visible to this new test

Whether that's right depends on the test design. e.g. if each test method inherently deals with different blob keys, then having the temp directory initialized once is fine.

If you want to switch from @BeforeClass to @Before, just make sure to keep the same descriptive names. The whole reason JUnit4 switched to annotated methods is to avoid having the non-descript "setup" and "teardown" methods of JUnit3.

@uakyol uakyol requested a review from SanjayVas June 20, 2023 21:31
@uakyol
Copy link
Contributor Author

uakyol commented Jun 20, 2023

src/test/kotlin/org/wfanet/measurement/loadtest/dataprovider/EdpSimulatorTest.kt line 300 at r4 (raw file):

Previously, SanjayVas (Sanjay Vasandani) wrote…

Whether that's right depends on the test design. e.g. if each test method inherently deals with different blob keys, then having the temp directory initialized once is fine.

If you want to switch from @BeforeClass to @Before, just make sure to keep the same descriptive names. The whole reason JUnit4 switched to annotated methods is to avoid having the non-descript "setup" and "teardown" methods of JUnit3.

thanks, I kept it as @Before and updated the "setup" method name to "initSketchStore" thats what you were referring to right?

Copy link
Member

@SanjayVas SanjayVas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Marco-Premier)

Copy link
Collaborator

@stevenwarejones stevenwarejones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Marco-Premier)

@uakyol uakyol merged commit 59f2a10 into main Jun 21, 2023
@uakyol uakyol deleted the uakyol/checkMcEdpSimulator branch June 21, 2023 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants