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

[READY] issue-128 - Adding golden files for template validation on openwrt #129

Merged
merged 7 commits into from
Feb 9, 2019

Conversation

sarcasticadmin
Copy link
Member

@sarcasticadmin sarcasticadmin commented Feb 5, 2019

Description of PR

@owendelong @kylerisse @davidelang

Related to: #128

Golden files will now be used to validate the output of gomplate for the openwrt configs. Some of the work that makes this possible was just merged into master for gomplate. Mainly: hairyhenderson/gomplate#468 So Ill be waiting eagerly for a new version to drop. For now it requires building the gomplate binary directory with go get

Specific commit that enabled this functionality was: d1873444c90e68b5e8ba7492fb83abd36d7ab0ea

Previous Behavior

No automated testing for generated files

New Behavior

  • Automated testing of generated openwrt config files
  • Renamed openwrt.yaml.example to openwrt-example.yaml (see commit message)
  • Added .gomplateignore file to make sure it doesnt incldue .swp if you have a template open in another window
  • Updated the documentation

Tests

How was this PR tested?

cd tests/unit/openwrt
sh test.sh

If it returns 0 then there's not a diff from the ./tmp dir and your templates match!

@@ -21,7 +22,7 @@ wired:
networks:
# interface names cant have special characters
- name: 'mgmt'
ifname: 'eth1.103 eth1.503'
ifname: 'eth1'
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this in the example so when Im building the openwrt imgs I dont have to setup a vlan locally. I usually forget to do that and then spend a bit figuring out why I cant connect

@sarcasticadmin sarcasticadmin changed the title {READY] issue-128 - Adding golden files for template validation on openwrt [READY] issue-128 - Adding golden files for template validation on openwrt Feb 5, 2019
Copy link
Collaborator

@owendelong owendelong left a comment

Choose a reason for hiding this comment

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

Generally looks god. I understand about the ifname in the test environment for now, but let's make sure we change it back and test before the show.

gomplateingnore should probably be *.sw? because if a .swp file exists and vi crashes again on the same file, you get .swo, .swn, ...

@sarcasticadmin
Copy link
Member Author

@owendelong ya i actually use a completely different openwrt.yaml for the show so thats not a problem.

Thats a good idea, Ill update the gomplateignore to account for all cases

Gomplate isnt able to identify files that end in something other
than there expected file extension. Renaming the secrets example
for openwrt so tests work without the need to create the openwrt.yaml
file
@kylerisse
Copy link
Member

Merging this. Will also capture new gomolate and test.sh into #130 . This looks good @sarcasticadmin thank you!

@kylerisse kylerisse merged commit 2b52230 into socallinuxexpo:master Feb 9, 2019
@sarcasticadmin
Copy link
Member Author

@kylerisse thanks! Ill keep an eye out the additions to #130

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.

3 participants