Repository navigation
Integration tests refactor - #26
Conversation
|
TODO: Need to update changelog. |
564fec7 to
44a91d7
Compare
DragonZ
left a comment
There was a problem hiding this comment.
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.Projectso we don't need to make breaking changes in the future.Refactor
cmdpackageThe 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.