Skip to content
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

automatically calculate duration #375

Merged
merged 5 commits into from
Mar 26, 2020
Merged

Conversation

YangKeao
Copy link
Member

Signed-off-by: Yang Keao [email protected]

What problem does this PR solve?

Calculate time chaos offset automatically.

What is changed and how does it work?

Check List

Tests

  • Manual test

Code changes

  • Has Go code change

Side effects

  • Breaking backward compatibility

Related changes

  • Need to update the documentation

Does this PR introduce a user-facing change?:

Should use new form of timeOffset field.

@YangKeao YangKeao requested review from fewdan and cwen0 March 24, 2020 08:47
@codecov-io
Copy link

Codecov Report

Merging #375 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #375   +/-   ##
=======================================
  Coverage   56.93%   56.93%           
=======================================
  Files          60       60           
  Lines        3820     3820           
=======================================
  Hits         2175     2175           
  Misses       1471     1471           
  Partials      174      174           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba9fb0b...c357bbc. Read the comment docs.

@@ -285,11 +286,19 @@ func (r *Reconciler) applyContainer(ctx context.Context, client chaosdaemon.Chao
return err
}

r.Log.Info("setting time shift", "mask", mask, "sec", chaos.Spec.TimeOffset.Sec, "nsec", chaos.Spec.TimeOffset.NSec)
duration, err := time.ParseDuration(chaos.Spec.TimeOffset)
Copy link
Member

Choose a reason for hiding this comment

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

split this logic to a single help function? So we can add the unit test for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes!

Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

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

Rest LGTM

timeOffset:
sec: 100000
nsec: 100000
timeOffset: "-10m100ns"
Copy link
Member

Choose a reason for hiding this comment

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

Remember to update the Wiki

fewdan
fewdan previously approved these changes Mar 25, 2020
Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Yang Keao <[email protected]>
@YangKeao YangKeao requested review from cwen0 and fewdan March 26, 2020 07:25
Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

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

LGTM

@cwen0 cwen0 merged commit 3dd2042 into chaos-mesh:master Mar 26, 2020
@YangKeao YangKeao deleted the parse-duration branch August 3, 2020 03:43
sjwsl pushed a commit to sjwsl/chaos-mesh that referenced this pull request May 6, 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.

4 participants