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

Tests update: Use require package in fleets package #1685

Merged
merged 5 commits into from
Jul 17, 2020

Conversation

akremsa
Copy link
Contributor

@akremsa akremsa commented Jul 9, 2020

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / Why we need it:
Use require package to abort test in order to avoid nil pointer exceptions.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: d6141283-019e-4e41-9b2a-0f613fc23143

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@akremsa akremsa force-pushed the fix_fleets_controller_tests branch from 63acd22 to 108149f Compare July 9, 2020 11:30
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 3a818873-71a0-4428-a957-1d2140a17951

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@akremsa akremsa changed the title Tests update: Use require package in fleets/controller_test Tests update: Use require package in fleets package Jul 9, 2020
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: c7b8b6fe-a487-4139-98ac-874309647f9d

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@akremsa akremsa force-pushed the fix_fleets_controller_tests branch from 935d333 to f692db8 Compare July 9, 2020 13:39
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: afea8c59-1e02-4ca1-ace6-ddc0e30ee8a9

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1685/head:pr_1685 && git checkout pr_1685
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-f692db8

@markmandel
Copy link
Member

I question if we should be replacing all asserts with require? Just thinking of other work that might be more valuable long term.

Or should we just replace the instances where we are doing variations of FailNow()?

@akremsa
Copy link
Contributor Author

akremsa commented Jul 10, 2020

One benefit which I see from using assert is that it will show ALL failed cases if they exist at once. For example:

a := "a"
b := "b"
assert.Equal(t, "zzz", a)
assert.Equal(t, "zzz", b)

This code will output 2 errors for each assert at once which can be useful to see all possible failed test cases.
I prefer to use require only for those cases where we want to abort test execution.
On the other hand - sometimes it doesn't make sense to proceed with a test if one scenario is marked as Failed, but I think it's a developer's responsibility to write efficient tests.

@markmandel
Copy link
Member

I prefer to use require only for those cases where we want to abort test execution.

100% agree 👍

@akremsa akremsa force-pushed the fix_fleets_controller_tests branch from f692db8 to 7befbf0 Compare July 10, 2020 15:55
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: f13aebe0-b097-4048-8447-de09ca3373f1

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@akremsa akremsa force-pushed the fix_fleets_controller_tests branch from 7befbf0 to a6c1db2 Compare July 13, 2020 10:52
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 74de68e2-12de-4ab5-b8e1-ed0c4b6f47b0

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel
Copy link
Member

Does it make sense to close this PR? Since it looks like it won't be merged in it's current state? (sorry @akremsa !)

@akremsa
Copy link
Contributor Author

akremsa commented Jul 14, 2020

@markmandel do you mean failed builds? Otherwise, this PR is perfectly fine, no?

@markmandel
Copy link
Member

Let me come at this question another way - is all the places you've updated in this PR places where we want to abort execution of the test at the time of failure?

Maybe I misunderstood where we ended up.

@akremsa
Copy link
Contributor Author

akremsa commented Jul 14, 2020

"is all the places you've updated in this PR places where we want to abort execution of the test at the time of failure"
Yes, exactly. I abort tests in cases where there is no point to continue.
And I suggest doing the same in the future.

@markmandel
Copy link
Member

Ah! Got it. I will review this with that in mind. In which case, ignore my previous comment!

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 670f8584-a6a7-4ead-8dab-429b01260000

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1685/head:pr_1685 && git checkout pr_1685
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-327f75b

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

LGTM!

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akremsa, markmandel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: e2d881a9-f311-485d-aaaf-dd61fbe735dd

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel
Copy link
Member

make[1]: *** [ensure-build-sdk-image] Error 2
includes/sdk.mk:171: recipe for target 'run-sdk-conformance-test-rest' failed

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: b8bd80d1-a50f-494c-a3ca-e2af7424cf94

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1685/head:pr_1685 && git checkout pr_1685
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-f704fa7

@markmandel markmandel merged commit f9f4a26 into googleforgames:master Jul 17, 2020
@markmandel markmandel added area/tests Unit tests, e2e tests, anything to make sure things don't break kind/cleanup Refactoring code, fixing up documentation, etc labels Jul 17, 2020
@markmandel markmandel added this to the 1.8.0 milestone Jul 17, 2020
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
)

* use require in fleets controller_test

Co-authored-by: Alexander Apalikov <alexander.apalikov@globant.com>
Co-authored-by: Mark Mandel <markmandel@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/tests Unit tests, e2e tests, anything to make sure things don't break cla: yes kind/cleanup Refactoring code, fixing up documentation, etc size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants