-
Notifications
You must be signed in to change notification settings - Fork 18
Feature/variables teststep #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8a2a25d to
c9d4fc5
Compare
Codecov Report
@@ Coverage Diff @@
## main #124 +/- ##
==========================================
- Coverage 63.38% 57.01% -6.37%
==========================================
Files 164 154 -10
Lines 10284 9985 -299
==========================================
- Hits 6518 5693 -825
- Misses 3045 3577 +532
+ Partials 721 715 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
9e5ab93 to
5a41e06
Compare
pkg/runner/test_steps_variables.go
Outdated
| return sva.AddRaw(tgtID, name, b) | ||
| } | ||
|
|
||
| func (sva *stepVariablesAccessor) AddRaw(tgtID string, name string, inRaw json.RawMessage) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you already have the Add(in interface{}); should be able to use that directly
if raw, ok := in.(json.RawMessage); ok {
sva.tsv.Add(raw)
return
}
| @@ -0,0 +1,78 @@ | |||
| package variables | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add docs md (see exec plugin for example))
tests/e2e/e2e_test.go
Outdated
| } | ||
| } | ||
|
|
||
| func (ts *E2ETestSuite) startTask(taskFile string) types.JobID { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consistency in naming concepts
| func (ts *E2ETestSuite) startTask(taskFile string) types.JobID { | |
| func (ts *E2ETestSuite) startJob(descriptorFile string) types.JobID { |
| return teststeps.ForEachTarget(Name, ctx, ch, func(ctx xcontext.Context, target *target.Target) error { | ||
| for name, ps := range inputParams { | ||
| ctx.Debugf("add variable %s, value: %s", name, ps[0]) | ||
| if err := stepsVars.AddRaw(target.ID, name, ps[0].RawMessage); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so... whats the usage for this? renaming strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the plugin in general or that specific loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the plugin; i see it takes in strings, with possible interpolations, and outputs the result as a single string; this could be done just as well in the consumers of these output vars here. unless there's something im not seeing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, it is not a super-useful plugin. One can just directly put these strings in consuming plugins as you mentioned.
I made it because of three reasons:
- it shows an example of how to use StepVariables and is also used in e2e test. ConTest has a number of "example" plugins like echo or randecho.
- it allows to make constants that will be reused in multiple places. For example: if two or more plugins should consume the same parameter, one can use this plugin instead of copy-pasting.
- on the future if step variables will have more options of being used (not just via parameters expanding) it could become a handy way to share variables
Add e2e TestVariables that checks step variables Signed-off-by: Ilya <rihter007@inbox.ru>
5a41e06 to
e320523
Compare
|
the added doc file makes it much more clear what the plugin is about |
Also the PR reveals variables usage in the new E2E test