Skip to content

Conversation

@aramprice
Copy link
Member

This PR contains code and test reorganization which will enable #92

This replaces a separate create-packer-ci-key task to make `fly execute`
easier.
@aramprice aramprice force-pushed the code-cleanup-testing-improvements branch from b93e9cd to 2c83dc1 Compare August 15, 2025 18:47
These rarely fail intermittently and multiple attempts slow down
feedback. At least as of 2025...

- cleanup quoting in pipeline yaml
This function no longer appears to be used within the windows stemcell
repositoires. This was likely needed for versions of Windows older than
the one currently being built (windows-2019).
- add `stembuild/out/` to gitignore
mockgen was used in only on place

- regenerate counterfeiter fakes
as of Ginkgo v2 it is no longer needed to be able to `go run` ginkgo
Fixes spacing and variable scoping
- extract constants
- capture error from Write() and panic if present
- message used fantasy (2035) version instead of actual (2019)
- extract common `write` func
- extract messenger from main()
- remove references to pivotal email
- packagers use Messenger not STDOUT/STDERR

Use base messenger methods and spy on output rather than fake messengers
with specific output funcs that are mocked.
- parse args early
  - print error if arg parsing fails
- print version info early if requested
- simplify Messenger struct
- use one context.Background()
- use defer to remove stemcell automation artifact

As part of this the environment_variable_warnings_test is updated
because the output of `stembuild version` is printed before the ENV vars
are validated.
Originally these tests relied on spying on "Messenger" structs, this
commit changes the specs to also assert on the invocation (or not) of
collaborator code instead of relying mostly on log output to test
behavior.
- rename constant for clarity
- use backtick to elimiate string escaping
- extract method to build VM auth parameter `-l ...`
- rename internal struct for clarity
- normalize spacing
- move private members to end of file
- some tests under iaas_cli/ can be run locally but not when mixed with
  specs which require access to vCenter or similar setup
- moves tests which require external resources under
  integration/iaas_cli/
- iaas_clients tests explicitly pass the vCenter's certificate, the
  integration/iaas_cli/ specs previously were not run on windows and on
  linux they rely on test setup which adds the certificate to the
  container's certificate store; the specs now write the certificate to
  disk and pass this path to vcenterclientfactory.FactoryConfig, as the
- "contract tests" use vcsim as library, instead of building from
  source, this should allow testing on windows
- (more) test code uses "_test" package names
@aramprice aramprice force-pushed the code-cleanup-testing-improvements branch from 2c83dc1 to 958ce3f Compare August 15, 2025 19:01
Pipeline uses DHCP for vSphere VMs created during stembuild.
@github-project-automation github-project-automation bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Aug 18, 2025
@aramprice aramprice merged commit 5c7f534 into windows-2019 Aug 18, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Aug 18, 2025
@aramprice aramprice deleted the code-cleanup-testing-improvements branch August 18, 2025 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants