Skip to content

setup/evaluate env context after setup steps context.#309

Merged
TingluoHuang merged 1 commit intomasterfrom
users/tihuang/fixenvcontext
Jan 31, 2020
Merged

setup/evaluate env context after setup steps context.#309
TingluoHuang merged 1 commit intomasterfrom
users/tihuang/fixenvcontext

Conversation

@TingluoHuang
Copy link
Copy Markdown
Member

fixing #308

// Populate env context for each step
Trace.Info("Initialize Env context for step");
// Initialize scope
if (InitializeScope(step, scopeInputs))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

steps context get set up in InitializeScope

}

// Initialize scope
if (InitializeScope(step, scopeInputs))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the change just moves this up.


var env2 = new MappingToken(null, null, null);
env2.Add(new StringToken(null, null, null, "env1"), new StringToken(null, null, null, "1000"));
env2.Add(new StringToken(null, null, null, "env2"), new BasicExpressionToken(null, null, null, "steps.foo.outputs.test"));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

make sure env that reference steps context can be resolved.

@TingluoHuang TingluoHuang force-pushed the users/tihuang/fixenvcontext branch from b0bc669 to 9634123 Compare January 30, 2020 01:41
@TingluoHuang TingluoHuang requested a review from thboop January 30, 2020 16:57
Comment thread src/Test/L0/Worker/StepsRunnerL0.cs Outdated
stepContext.Setup(x => x.Write(It.IsAny<string>(), It.IsAny<string>())).Callback((string tag, string message) => { trace.Info($"[{tag}]{message}"); });
stepContext.Object.Result = result;
step.Setup(x => x.ExecutionContext).Returns(stepContext.Object);
step.Setup(x => x.RunAsync()).Callback(() => { _stepContext.SetOutput(null, name, "test", "something", out string reference); }).Returns(Task.CompletedTask);
Copy link
Copy Markdown
Collaborator

@thboop thboop Jan 30, 2020

Choose a reason for hiding this comment

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

Consider doing this in the test that needs it (PopulateEnvContextAfterSetupStepsContext), not the shared test setup code.

Can we keep the original step.Setup(x => x.RunAsync()).Returns(Task.CompletedTask); and override it after its been returned as needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

will do. :)

Copy link
Copy Markdown
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

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

Clean PR, LGTM.

Minor thoughts

@TingluoHuang TingluoHuang force-pushed the users/tihuang/fixenvcontext branch from 9634123 to a1a2c71 Compare January 31, 2020 03:04
@TingluoHuang TingluoHuang merged commit a0a590f into master Jan 31, 2020
@TingluoHuang TingluoHuang deleted the users/tihuang/fixenvcontext branch January 31, 2020 03:14
AdamOlech pushed a commit to antmicro/runner that referenced this pull request Jan 28, 2021
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.

2 participants