Skip to content

Ability to isolate tests #742

Closed
Closed

Description

@uk-bolly

Describe the feature:
Running industry benchmarks testing these can mean ensuring that different lines may occur within the same file each with a unique test. These will have differing titles, meta data dependent on the test that takes place.

I am sure this type of testing that may occur is not unique to this but the is an example i am working with.

In the example below
It appears the filename used by the file test is the unique identifier and therefore only take the output of the final test that runs. These benchmarks for each line could be in the same file or different files. Only the last benchmark that runs using the goss test reports the output.

e.g.
file:
/etc/somefilename:
{{ if .Vars.test1 }}
title: test1
exists: true
contains:
- test1_line
meta:
test1_ID
other_data
{{ end }}
{{ if .Vars.test2 }}
title: test2
exists: true
contains:
- test2_line
meta:
test2_ID
other_data
{{ end }}

If both are enabled the output would only show test2 information.

I have tested with different files, filenames etc.

Is there a better way that i can achieve this?

Describe the solution you'd like

Ability to run the different requirements on using a like goss test and control that is able to report back all the output and the associated data

Describe alternatives you've considered
Rewrite each control with the command test and rename that command title to make them unique. But using the actual goss test is more efficient and less calls than running the command test.

Activity

  1. uk-bolly commented on Feb 14, 2022

    @uk-bolly
    Author

    similar to #743

  2. ekelali commented on Feb 15, 2022

    @ekelali
    Collaborator

    Hello @uk-bolly,

    Would allowing the path to be set as an attribute similar to exec on command resolve this?

    For example: #431

  3. uk-bolly commented on Feb 16, 2022

    @uk-bolly
    Author

    Hi @ekelali

    Thank you for the response.
    This appears as i understand it (example below) to cover off that requirement well.

    e.g.

    file:
    controlid123:
    path: /etc/hosts

    controlid123:
    path: /etc/hosts

    Thanks uk-bolly

  4. ekelali commented on Feb 18, 2022

    @ekelali
    Collaborator

    Also, this issue may be related, maybe this should be done for all resource types?

    #518

  5. uk-bolly commented on Mar 21, 2022

    @uk-bolly
    Author

    hi @ekelali

    Apologies for the delay,
    That would make sense to have the ability across all of the tests would be a good improvement and add consistency across those tests.

    thanks

  6. added a commit that references this issue on Jun 24, 2023
    bf22f82
  7. added a commit that references this issue on Jan 27, 2024
    2e5720b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址