DexterPOSH / PSRemotely

Remote operations validation framework, exposes a DSL to wrap existing Pester/PoshSpec based validation tests.
http://psremotely.readthedocs.io/en/latest/
MIT License
46 stars 7 forks source link

PSRemotely support to pass tag or Pester Splat hash #51

Open DexterPOSH opened 7 years ago

DexterPOSH commented 7 years ago

This one is not completely ready. Want the ability to specify tags to PSRemotely while invoking it.

Invoke-PSRemotely -Script S2Dvalidation.PSRemotely.ps1 -Tag VMMReadiness

Now the above should flow down the tag to the remote nodes and only run ops validation tests marked with the same tag.

DexterPOSH commented 7 years ago

Thinking aloud. Should PSRemotely support passing tags at two different scopes?

At Node scope

This would capability to organize tests targeting the same nodes.

PSRemotely {
    Node AD -Tag ServiceValidation {
         # Service tests
    }

    Node AD -Tag DomainGroupsValidation {
         # tests run on domain groups
    }
}

At Test scope

This would give capability to organize tests using Pester Describe blocks.

PSRemotely {
    Node AD {
         # Service tests
         Describe 'Service test' -tag Service {
              # tests
         }

         # Domain group tests
         Describe 'DomainGroups test' -tag domaingroup {
              # tests
         }
    }
} 

Now the default would be passing tags to test scope. For example -

Invoke-PSRemotely -Tag Service

Now the above would only run Pester tests (Describe blocks) marked with the specified tag.

To support more flexibility to the DSL by allowing tags at the node scope, thinking of adding -Tag parameter supports a hash table as an alternative like below:-

Invoke-PSRemotely -Tag @{Scope='Node';Name=@('ServiceValidation','DomainGroupsValidation')}
DexterPOSH commented 7 years ago

Or we can add a parameter named -PesterSplatHash which takes a hashtable and splats that to the Invoke-Pester on the PSRemotely node while running the tests. This is much cleaner and less amount of work.

DexterPOSH commented 7 years ago

This requires some unit and integration tests coverage before it can be merged.