Skip to content

Add field to allow skipping of tests#105

Merged
ycombinator merged 14 commits intoelastic:masterfrom
ycombinator:test-skip
Jan 14, 2021
Merged

Add field to allow skipping of tests#105
ycombinator merged 14 commits intoelastic:masterfrom
ycombinator:test-skip

Conversation

@ycombinator
Copy link
Copy Markdown
Contributor

@ycombinator ycombinator commented Jan 12, 2021

This PR adds a field to the pipeline and system test configuration files, allowing tests to be skipped.

Related: elastic/elastic-package#218

@ycombinator ycombinator requested a review from mtojek January 12, 2021 20:08
@elasticmachine
Copy link
Copy Markdown

elasticmachine commented Jan 12, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #105 updated

    • Start Time: 2021-01-14T21:50:07.628+0000
  • Duration: 3 min 6 sec

  • Commit: d77a22e

Copy link
Copy Markdown
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

I'm not in favor of skipping tests, but we may need it in the future. I would enforce the description and link with regexp :) Something like these (all fields required):

skip:
   url: 
   explanation:

WDYT?

@ycombinator
Copy link
Copy Markdown
Contributor Author

@mtojek thanks, I like this idea. It forces users to offer a short explanation for the skip and URL that has more details. 👍

@ycombinator
Copy link
Copy Markdown
Contributor Author

ycombinator commented Jan 13, 2021

@mtojek I addressed your review feedback. A few points to note:

  • I went with link instead of url because we already have a precedent for link here:
  • I went with reason instead of explanation because reason is shorter. 😄
  • I don't like that the definition of skip is repeated in two places. I tried refactoring it into a common file, similar to what we have with but I was not successful. I kept getting a Reference /spec.yml#/definitions/skip must be canonical error when I ran make test (after running make update).
    • The value of my $ref property looked like "../spec.yml/#definitions/skip" and in the data_stream/_dev/test/spec.yml file I had a spec.definitions.skip property.
    • Just for testing I even tried to create a common.yml file in the same folder as the referencing spec file and changed the value of $ref to "./common.yml/#definitions/skip" but that also gave the same error.
    • If you have some ideas as to what might be causing this error or what else I should try, please let me know.

@ycombinator ycombinator requested a review from mtojek January 13, 2021 20:22
@mtojek
Copy link
Copy Markdown
Contributor

mtojek commented Jan 14, 2021

I looked into this problem and found a workaround: https://github.com/mtojek/package-spec/tree/test-skip-fix-1

Most likely the inline content doesn't allow for jumping over remote resources or the location is not evaluated correctly.

@ycombinator
Copy link
Copy Markdown
Contributor Author

ycombinator commented Jan 14, 2021

Thanks @mtojek. I merged your workaround into this PR. Now I'm seeing a different test failure, which I'm investigating:

=== RUN   TestValidateFile/good
    validator_test.go:50:
                Error Trace:    validator_test.go:50
                Error:          Received unexpected error:
                                found 1 validation error:
                                   1. item [test-access-event.json-config.json] is not allowed in folder [../../internal/validator/test/packages/good/data_stream/foo/_dev/test/pipeline]
                Test:           TestValidateFile/good

@ycombinator
Copy link
Copy Markdown
Contributor Author

@mtojek This PR is ready for your re-review when you get a chance. Thanks!

@@ -0,0 +1,20 @@
spec:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the config is applicable in both modes now: raw and JSON. It's described also in docs for pipeline tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There appears to be a slight difference in the configs for the raw and JSON modes.

Raw:

- description: Configuration of test case in raw format
type: file
pattern: '^test-[a-z0-9-]+\.log-config.json$'
contentMediaType: "application/json"
required: false
content:
type: object
additionalProperties: false
properties:
fields:
description: Field definitions
type: object
additionalProperties: true
dynamic_fields:
description: Dynamic fields with regular expressions defining their variable values.
type: object
multiline:
description: Multi-line configuration
type: object
additionalProperties: true
numeric_keyword_fields:
description: List of keyword type fields allowed to have a numeric value.
type: array

JSON:

- description: Configuration of test case in JSON format
type: file
pattern: '^test-[a-z0-9-]+\.json-config.json$'
contentMediaType: "application/json"
required: false
content:
type: object
additionalProperties: false
properties:
fields:
description: Field definitions
type: object
additionalProperties: true
dynamic_fields:
description: Dynamic fields with regular expressions defining their variable values.
type: object
numeric_keyword_fields:
description: List of keyword type fields allowed to have a numeric value.
type: array

It looks like the raw mode supports multiline whereas the JSON mode does not.

That's why I had to end up creating two different spec files: config_raw.spec.yml and config_json.spec.yml.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, I see! In this case I think it's correct. Sorry about confusion.

@mtojek mtojek self-requested a review January 14, 2021 23:34
@ycombinator ycombinator merged commit 24c262a into elastic:master Jan 14, 2021
@ycombinator ycombinator deleted the test-skip branch January 14, 2021 23:35
rw-access pushed a commit to rw-access/package-spec that referenced this pull request Mar 23, 2021
* User volumes for service logs

* Fixes

* Bring back network connect

* Address PR comments

* WIP

* Expose env as aliases

* Fix
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