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

Bug/#781 create results dir #785

Merged
merged 8 commits into from
May 16, 2020
Merged

Conversation

adamfilipow92
Copy link
Contributor

Fixes #781

Checklist

  • Documented
  • Unit tested
  • release_notes.md updated

@codecov-io
Copy link

codecov-io commented May 15, 2020

Codecov Report

Merging #785 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #785   +/-   ##
=========================================
  Coverage     78.50%   78.50%           
  Complexity      692      692           
=========================================
  Files           133      133           
  Lines          2857     2857           
  Branches        411      411           
=========================================
  Hits           2243     2243           
  Misses          355      355           
  Partials        259      259           

@@ -55,19 +55,22 @@ class AndroidArgs(
private val androidGcloud = androidGcloudYml.gcloud
var appApk = (cli?.app ?: androidGcloud.app ?: throw FlankFatalError("app is not set")).processFilePath("from app")
var testApk = (cli?.test ?: androidGcloud.test)?.processFilePath("from test")
val additionalApks = (cli?.additionalApks ?: androidGcloud.additionalApks).map { it.processFilePath("from additional-apks") }
val additionalApks =
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls let's try to avoid autoformat changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right! I set auto line breaking to 200 chars but this changes was made before. It shouldn't happen any more.

@adamfilipow92 adamfilipow92 marked this pull request as draft May 15, 2020 13:58
@jan-goral jan-goral marked this pull request as ready for review May 15, 2020 14:02
@jan-goral jan-goral marked this pull request as draft May 15, 2020 14:03
@adamfilipow92 adamfilipow92 mentioned this pull request May 15, 2020
@adamfilipow92 adamfilipow92 marked this pull request as ready for review May 15, 2020 14:48
val resultsDir = UUID.randomUUID().toString()
val directoryPath = Paths.get(resultsDir)
if (Files.exists(directoryPath)) {
Assert.fail("Test directory ($resultsDir) shouldn't exists! It's remote directory.")
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a remote directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

""".trimIndent()
AndroidArgs.load(yaml)
if (Files.exists(directoryPath)) {
Assert.fail("Test directory ($resultsDir) shouldn't be created! It's remote directory on cloud!")
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a remote directory on the cloud!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

}

private fun AndroidArgs.Companion.load(yamlData: String, cli: AndroidRunCommand? = null): AndroidArgs = load(StringReader(yamlData), cli)
private fun AndroidArgs.Companion.load(yamlData: String, cli: AndroidRunCommand? = null): AndroidArgs =
load(StringReader(yamlData), cli)
Copy link
Contributor

Choose a reason for hiding this comment

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

format change? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sadly yes. I should check all files modified in this pr not only one. I revert changes. In future I will pay more attention for that.

release_notes.md Outdated
@@ -1,5 +1,6 @@
## next (unreleased)

- [#781](https://github.com/Flank/flank/pull/781) Create results-dir. ([adamfilipow92](https://github.com/adamfilipow92))
Copy link
Contributor

@bootstraponline bootstraponline May 15, 2020

Choose a reason for hiding this comment

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

The bug is, we should not call assertFileExists on gcloud.resultsDir. I'd update the release notes to say something like:

#781 Remove local exists check on cloud results-dir. Fixes crash when results-dir is set by the user. (adamfilipow92)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed!

* it's should be enough
*/
@Test
fun `should not throw if directory not exists`() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments should usually describe why we're doing something, not what we're doing.

Usually comments are useful when they explain why some code exists, and should not be explaining what some code is doing.

https://github.com/google/eng-practices/blob/master/review/reviewer/looking-for.md#comments

What do you think about this?

   @Test
   fun `results-dir (cloud directory) should not throw if it doesn't exist locally`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this feedback! I change test name and remove my comment. :)

@@ -0,0 +1,7 @@
gcloud:
app: ./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used anywhere? I think we inlined the example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's only used for my internal tests of this issue. I removed it from repository.

@bootstraponline bootstraponline added this to the June milestone May 16, 2020
@pawelpasterz pawelpasterz merged commit ceabb78 into master May 16, 2020
@pawelpasterz pawelpasterz deleted the bug/#781-Create-Results-Dir branch May 16, 2020 21:09
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.

Create results-dir
5 participants