Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

virtcontainers: Add unit test for types/container.go #2857

Merged

Conversation

cmaf
Copy link
Contributor

@cmaf cmaf commented Jul 24, 2020

Add unit tests for types/container.go. Tests were adapted from
sandbox_test.go since ContainerState is a sandbox state structure and
the transition tests are the same.

Fixes #2856

Signed-off-by: Chelsea Mafrica [email protected]

@cmaf cmaf added the needs-review Needs to be assessed by the team. label Jul 24, 2020
@auto-comment
Copy link

auto-comment bot commented Jul 24, 2020

Thank you for raising your pull request. Please note that the main development of Kata Containers has moved to the 2.0-dev branch of https://github.com/kata-containers/kata-containers repository. The kata-containers/runtime repository is kept for 1.x release maintenance. Please check twice if your change should go to the 2.0-dev branch directly.

If it is strongly required for adding the change to Kata Containers 1.x releases, please ping @kata-containers/runtime to assign a dedicated developer to be responsible for porting the change to 2.0-dev branch. Thanks!

@cmaf cmaf added the port-to-2.0 PRs that need to be ported to kata 2.0-dev branch label Jul 24, 2020
@cmaf
Copy link
Contributor Author

cmaf commented Jul 24, 2020

/test-ubuntu

@codecov
Copy link

codecov bot commented Jul 24, 2020

Codecov Report

Merging #2857 into master will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2857   +/-   ##
=======================================
  Coverage   51.05%   51.06%           
=======================================
  Files         118      118           
  Lines       17364    17372    +8     
=======================================
+ Hits         8866     8871    +5     
- Misses       7419     7422    +3     
  Partials     1079     1079           

@cmaf cmaf removed the port-to-2.0 PRs that need to be ported to kata 2.0-dev branch label Jul 24, 2020
Copy link
Contributor

@merwick merwick left a comment

Choose a reason for hiding this comment

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

LGTM - just a few questions.

@cmaf cmaf force-pushed the unittest-virtcontainers-container branch from 71c4298 to 35b8155 Compare July 27, 2020 18:57
@cmaf
Copy link
Contributor Author

cmaf commented Jul 27, 2020

@merwick Thanks for the review, I applied these changes. I also added a StoppedRunning test taken from the sandbox tests that I had previously omitted.

Copy link
Contributor

@merwick merwick left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

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

Thanks @cmaf. Just one suggestion.

}

ok := state.Valid()
assert.Equal(t, ok, expected)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd consider adding a string at the end of this call containing state and expected) to aid with debugging. It's a good habit to get into, particularly when trying to debug "remote failures" (those annoying tests that work locally but fail in the CI ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jodh-intel thanks for the comment, I added a message here

@lifupan
Copy link
Member

lifupan commented Jul 29, 2020

/test

@cmaf cmaf added the wip Work in Progress (PR incomplete - needs more work or rework) label Jul 29, 2020
Add unit tests for types/container.go. Tests were adapted from
sandbox_test.go since ContainerState is a sandbox state structure and
the transition tests are the same.

Fixes kata-containers#2856

Signed-off-by: Chelsea Mafrica <[email protected]>
@cmaf cmaf force-pushed the unittest-virtcontainers-container branch from 35b8155 to e8e1124 Compare July 29, 2020 16:11
@cmaf cmaf removed the wip Work in Progress (PR incomplete - needs more work or rework) label Jul 29, 2020
@cmaf
Copy link
Contributor Author

cmaf commented Jul 29, 2020

I'm also applying these changes to the 2.x PR, #452

/test

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

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

Thanks @cmaf.

lgtm

@cmaf cmaf merged commit bdcd2dd into kata-containers:master Aug 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-review Needs to be assessed by the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit tests for virtcontainers/types/container.go
5 participants