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

Do not write anything when nothing was changed #402

Merged
merged 29 commits into from
Jun 15, 2016

Conversation

mchf
Copy link
Member

@mchf mchf commented May 11, 2016

@mchf mchf force-pushed the fate318787-dont-force-restart branch from 21539b1 to 62a1c6e Compare May 11, 2016 11:44
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 43.755% when pulling 62a1c6e on mchf:fate318787-dont-force-restart into de8dc4e on yast:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.002%) to 44.446% when pulling 62a1c6e on mchf:fate318787-dont-force-restart into de8dc4e on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 44.463% when pulling 40d6a6d on mchf:fate318787-dont-force-restart into de8dc4e on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 44.472% when pulling e4aca6b on mchf:fate318787-dont-force-restart into de8dc4e on yast:master.

@mchf mchf force-pushed the fate318787-dont-force-restart branch from e4aca6b to 333e4af Compare May 12, 2016 11:52
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 44.481% when pulling 333e4af on mchf:fate318787-dont-force-restart into de8dc4e on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 44.481% when pulling ab2e93e on mchf:fate318787-dont-force-restart into de8dc4e on yast:master.

@mchf mchf force-pushed the fate318787-dont-force-restart branch from ab2e93e to e21a798 Compare June 6, 2016 12:00
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 45.537% when pulling e21a798 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 45.537% when pulling 2e887a3 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

mchf added 3 commits June 6, 2016 15:38
ProtectByFirewall method allways sets modified flag for firewall module.
So when called unconditionally it causes rewriting of network
configuration even when not needed (no zone changed).
@mchf mchf force-pushed the fate318787-dont-force-restart branch from 2e887a3 to 847b02b Compare June 6, 2016 14:31
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 45.799% when pulling 14ed002 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 45.783% when pulling 8e82f30 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 45.774% when pulling f35b789 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@@ -2031,15 +2031,12 @@ def Commit
# CanonicalizeIP is called to get new device map into the same shape as
# NetworkInterfaces provides the current one.
if current_map != NetworkInterfaces.CanonicalizeIP(new_map)
NetworkInterfaces.Name = Items()[@current]["ifcfg"] || ""
NetworkInterfaces.Current = deep_copy(newdev)
Items()[@current]["ifcfg"] = "" if !NetworkInterfaces.Change2(Items()[@current]["ifcfg"], newdev, false)
Copy link
Member

Choose a reason for hiding this comment

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

please assign that false to a explode_if_existing or whatever, before use

Copy link
Member

Choose a reason for hiding this comment

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

we can factor out the Items access if we use a mutating method on ::String:

ifcfg_name = Items()[@current]["ifcfg"]
explode = false
ifcfg_name.replace("") if !NetworkInterfaces.Change2(ifcfg_name, newdev, explode)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 45.791% when pulling d2ef6e1 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@mvidner
Copy link
Member

mvidner commented Jun 13, 2016

LGTM.

The coverage has increased slightly but I've noticed that Lan.Modified, which is being changed, remains uncovered. It would be an easy win if you feel like keeping an eye on the numbers.

@mchf
Copy link
Member Author

mchf commented Jun 13, 2016

Thanks for hint. I'm going for another 0.001% ;-) Any small step towards 50% test coverage is appreciated ;-)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 45.791% when pulling bc3ba1e on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 45.791% when pulling 75a8d87 on mchf:fate318787-dont-force-restart into a5698c2 on yast:master.

@mchf
Copy link
Member Author

mchf commented Jun 13, 2016

@mvidner
I've added the testsuite and changelog. Could you pls check these two updates?

@mvidner
Copy link
Member

mvidner commented Jun 15, 2016

Once Lan.Modified is tested, the coverage should increase by 0.1% (7 lines of 6510). But we don't see such a change in the coveralls report.

.to receive(method)
.and_return true

expect(modname.send(method)).to be true
Copy link
Member

Choose a reason for hiding this comment

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

Here you mock a method and then you call it. It does succeed but it is not testing any of production code.

@mchf
Copy link
Member Author

mchf commented Jun 15, 2016

That's bcs I forgot to actually run the test on Lan.Modified. Fix is on the way. Thanks

@mchf mchf force-pushed the fate318787-dont-force-restart branch from bc3ba1e to 57ccc88 Compare June 15, 2016 07:34
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 45.822% when pulling 57ccc88 on mchf:fate318787-dont-force-restart into cc8f60f on yast:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 45.883% when pulling 0be5e01 on mchf:fate318787-dont-force-restart into cc8f60f on yast:master.

@mchf mchf force-pushed the fate318787-dont-force-restart branch from 0be5e01 to f56d2cd Compare June 15, 2016 08:29
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 45.899% when pulling f56d2cd on mchf:fate318787-dont-force-restart into cc8f60f on yast:master.

@mvidner
Copy link
Member

mvidner commented Jun 15, 2016

Yay! LGTM.

@mchf
Copy link
Member Author

mchf commented Jun 15, 2016

Thank you.

@mchf mchf merged commit f85b5a5 into yast:master Jun 15, 2016
@mchf mchf deleted the fate318787-dont-force-restart branch June 15, 2016 08:47
@mvidner mvidner changed the title [WIP] Do not write anything when nothing was changed Do not write anything when nothing was changed Jun 21, 2016
@mchf mchf restored the fate318787-dont-force-restart branch October 10, 2016 06:30
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.

None yet

3 participants