-
Notifications
You must be signed in to change notification settings - Fork 31
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
Integration tests refactor #26
Conversation
TODO: Need to update changelog. |
564fec7
to
44a91d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always feel confused by the struct/file/directory names in astro
. For example,
Under astro/astro/
, there is a file named astro
. The top level Project
struct is here.
type Project struct {
config *conf.Project
sessions *SessionRepo
terraformVersions *tvm.VersionRepo
}
Inside the Project
struct, there is a config
member variable whose type is Project
from conf
package. But when I go inside conf
package, I could not find some file named project.go
and in the end I find another file named astro.go
which defined conf.Project
.
Similarly in astro/astro/config.go
, instead of seeing some config
struct and its methods, there are constructor functions for different Project
structs.
func NewConfigFromFile(configFilePath string) (*conf.Project, error)
func NewProjectFromConfigFile(configFilePath string) (*Project, error)
func NewProjectFromYAML(yamlBytes []byte) (*Project, error)
func configFromYAML(yamlBytes []byte, rootPath string) (*conf.Project, error)
Without IDE's help, I could easily get lost navigating between different files during the review. Maybe we can give them more intuitive names.
These are really good comments. Let's file them away in an issue so we can fix this later. Maybe it could be a good task for you to take on? :-) |
This refactors the integration tests to run in-process instead of compiling and executing the binary separately.
Move integration tests to
tests/
directoryIntegration tests that execute Terraform are now in the top-level directory.
Use functional options pattern
This is a breaking change that introduces the functional options pattern for
astro.Project
so we don't need to make breaking changes in the future.Refactor
cmd
packageThe CLI application and state is now part of a struct that can be instantiated. Global variables have been removed. This improves testability as well as understanding of what's going on. Code has been cleaned up to be more readable.
Since this is a breaking API change we'll bump a minor version.