Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Referencing $cfg inside Test Files #131

Open
midacts opened this issue Apr 16, 2017 · 2 comments
Open

Referencing $cfg inside Test Files #131

midacts opened this issue Apr 16, 2017 · 2 comments

Comments

@midacts
Copy link
Contributor

midacts commented Apr 16, 2017

This is more of a FYI and making sure that this is the best way to handle it.

Currently $Desired = $cfg.... is the only time $cfg is allowed to be referenced in a test files do to these
lines (specifically the lines referencing $Cfgline).
(and it then being passed to Set-VesterConfigValue.ps1)

I was able to work around this in Test Files by doing things like this:

$Save = Get-ChildItem Variable: | Where-Object {$_.Value -Match "host"}
$DCUIAccess = $Save.Value.Host.dcuiaccess

Are you guys okay with using the above types of references in test files?
I think it is easier than refactoring parts of New-VesterConfig.ps1

@michaeltlombardi
Copy link
Contributor

Should this be a documentation issue where we add a concept document for how this works / help people understand if this is an anti-pattern or not and considerations to be taken when doing it?

@midacts
Copy link
Contributor Author

midacts commented Jun 23, 2017

Whatever works.
I was just bringing up things I was running into when i was digging more into issues.

Basically it is referencing variables from the config file in other test files.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants