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

Remove invalid ref to err #97

Merged
merged 4 commits into from
Sep 6, 2018
Merged

Remove invalid ref to err #97

merged 4 commits into from
Sep 6, 2018

Conversation

worldtiki
Copy link
Collaborator

Using an invalid kill type causes a "invalid memory address or nil pointer" error to occur.
This is caused by a reference to an uninitialised err.

This pull request fixes issue #96.

func (s *ChaosTestSuite) TestInvalidKillType() {
v := s.chaos.victim.(*victimMock)
killValue := 1
v.On("KillType", s.client).Return("InvalidKillTypeHere", nil)
Copy link
Owner

Choose a reason for hiding this comment

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

Do you know how this would behave if the pod/app had an invalid value for KillType and no value for KillValue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The killValue is assigned on line 109 and if that operation fails it returns an error.
That logic seems to be in eligible_daemonsets.go/eligigle_statefulsets.go. There are some checks there to assert that the value is a positive int so I think we're cool.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm wondering more of the case where someone sets an invalid KillType on their pod, and no KillValue.

It seems like we will check KillValue (line 109, chaos.go), get an error and terminate a single pod (line 112) despite the incorrect value for KillType.

Does that sound correct? If yes, lets file that as an Issue and fix it separately.

@Aergonus
Copy link
Collaborator

Aergonus commented Sep 5, 2018

Wow thanks for catching this. My bad for copy pasting the error messages.

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.

3 participants