Skip to content

Add sync test and refactor InParallel#2118

Merged
dgageot merged 3 commits intoGoogleContainerTools:masterfrom
tejal29:add_sync_tests
May 24, 2019
Merged

Add sync test and refactor InParallel#2118
dgageot merged 3 commits intoGoogleContainerTools:masterfrom
tejal29:add_sync_tests

Conversation

@tejal29
Copy link
Copy Markdown
Contributor

@tejal29 tejal29 commented May 14, 2019

Some work from #2091

  • Added a test to make sure InSequence builds are run in sequence.
  • Cleaned up parallel.go by adding functions.
  • Used sync.Map to collect parallel build results which are safe to use since as per the docs
    The Map type is optimized for two common use cases: (1) when the entry for a given key is only ever written once but read many times, as in caches that only grow, or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex.
    In our case, one go subroutine adds exactly one key and they are always disjoint.
  • Added Individual unit tests.
  • Test cases cover code branches and not just errors.

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 16, 2019

Codecov Report

Merging #2118 into master will increase coverage by 0.28%.
The diff coverage is 92.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2118      +/-   ##
==========================================
+ Coverage   57.31%   57.59%   +0.28%     
==========================================
  Files         186      187       +1     
  Lines        7871     7950      +79     
==========================================
+ Hits         4511     4579      +68     
- Misses       2948     2958      +10     
- Partials      412      413       +1
Impacted Files Coverage Δ
pkg/skaffold/build/parallel.go 93.44% <92.72%> (+3.64%) ⬆️
cmd/skaffold/app/cmd/build.go 64% <0%> (-4.43%) ⬇️
cmd/skaffold/app/cmd/delete.go 61.53% <0%> (-2.1%) ⬇️
pkg/skaffold/config/options.go 92.68% <0%> (-0.18%) ⬇️
cmd/skaffold/app/cmd/flags.go 92.59% <0%> (ø)
cmd/skaffold/app/cmd/cmd.go 74.57% <0%> (+1.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b7a28e...6db2fe5. Read the comment docs.

tejal29 added 3 commits May 20, 2019 16:29
Now suddenly the opportunities to test have opened up!

TODO:
Add tests for individual refactored method.
On my branch, test number are:
sequence.go -> 100%
parallel.go -> 96.2%
@dgageot dgageot merged commit 90059f1 into GoogleContainerTools:master May 24, 2019
@tejal29 tejal29 deleted the add_sync_tests branch April 15, 2021 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants