Repository navigation
Add tests for ddevapp package - #85
Conversation
|
👍 this is now ready for review. |
… docker-compose file
…ensure it has expected values
rfay
left a comment
There was a problem hiding this comment.
I didn't give this my heart and soul, but added a couple of comments for recommendations, pretty simple things to add. Thanks for this, and for the good thinking behind it. Another step forward.
| f, err := os.Create(c.DockerComposeYAMLPath()) | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| return err |
There was a problem hiding this comment.
I liked the fatal before, although it could use more context. But it seems like this is going nowhere if the docker-compose path can't be created.
There was a problem hiding this comment.
I agree that in most cases this should be a fatal. That being said, I believe it's improper for the package to do the fatal. Rather, the caller should receive in error back and have to determine what to do with it. In this case, the CLI should be the one deciding this is a fatal error, imho.
There was a problem hiding this comment.
In this case then we at least have to stop right there and return the err. Currently it gets overwritten as the function continues on its merry way.
There was a problem hiding this comment.
Agreed. Looking at the code. I see the caller (in the local package) is not handling this error. It should.
I believe this line is correct, but we absolutely need to make sure supporting code is on the same page.
| } | ||
|
|
||
| // SetInputScanner allows you to override the default input scanner with your own. | ||
| func setInputScanner(scanner *bufio.Scanner) { |
| } | ||
| } | ||
|
|
||
| // TestPrepDirectory ensures the configuraion directory can be created with the correct permissions. |
| // Create a docroot folder. | ||
| err := os.Mkdir(filepath.Join(testDir, "docroot"), 0644) | ||
| if err != nil { | ||
| t.Skip("Could not create docroot directory under %s", testDir) |
There was a problem hiding this comment.
I'd be more in favor of a full fail in this case... ???
There was a problem hiding this comment.
Probably wise. In practice this should never happen, but probably better just to fail loudly if it does.
|
LGTM 👍 |
…o caller if we cannot write docker-compose. Fix typos. Error if we cannot create a docroot folder in config tests
|
🎉 |
The Problem:
We need tests for the appconfig package. This is a work in progress, just opening for automation. A better writeup will be writen once we get closer to merge time.
Automation Overview:
This entire PR is automation. As an overview, you should review the changes to the
testcommonpackage as well asconfig_test.go.Coverage numbers for the ddevapp package:
Related Issue Link(s):
#27