foreman_discovery icon indicating copy to clipboard operation
foreman_discovery copied to clipboard

Fix rubocop offenses

Open archanaserver opened this issue 1 year ago • 12 comments

archanaserver avatar Jan 16 '24 11:01 archanaserver

I can see one rubocop offense on this cop Style/SlicingWithRange which we might have discussed in the past, https://docs.rubocop.org/rubocop/cops_style.html#styleslicingwithrange. Also this is unsafe, but what's your thought on this @ekohl, do we want this here?

And another one is Rails/ReversibleMigration.

archanaserver avatar Jan 16 '24 12:01 archanaserver

Tests are failing but I guess not because of the changes here. I need to take a look what's going on there.

stejskalleos avatar Jan 18 '24 09:01 stejskalleos

We can see in https://github.com/theforeman/foreman_discovery/pull/615 that the test suite is already broken. That makes it hard to judge if these items break anything (further) or not.

ekohl avatar Jan 19 '24 19:01 ekohl

In ruby tests, there is one test that is failing everywhere:

Failure:
HostDiscoveredTest#test_0024_should refresh facts and NICs of an existing discovered host [foreman_discovery/test/unit/host_discovered_test.rb:274]
Minitest::Assertion: Expected: "Dishwasher DW400"
  Actual: "IBM System x -[78[70](https://github.com/theforeman/foreman_discovery/actions/runs/7602436753/job/20703002127?pr=616#step:13:71)K4G]-"

I will take a look during this week.

The foreman_discovery was failing since I am a maintainer of the repo, I tried to reproduce the problem without any success.

stejskalleos avatar Jan 22 '24 09:01 stejskalleos

In ruby tests, there is one test that is failing everywhere:

This is:

https://github.com/theforeman/foreman_discovery/blob/6aaa8d26a76c326f38cc87d9d40b331b1c381c57/test/unit/host_discovered_test.rb#L263-L277

It's updating the legacy fact productname while since https://github.com/theforeman/foreman/commit/cc4a95ffbe24ddc1bc16dd3f13ceef2a742331f9 we prefect the modern fact dmi.product.name. Though the fixture (https://github.com/theforeman/foreman_discovery/blob/develop/test/facts/regular_host.json) doesn't contain the modern fact at all.

ekohl avatar Jan 23 '24 12:01 ekohl

It could also be caching facts via https://github.com/theforeman/foreman/commit/735b40161176be270934998a126b42e90c0e9724.

ekohl avatar Jan 23 '24 12:01 ekohl

It could also be caching facts via theforeman/foreman@735b401.

From some testing it does appear to be failing it, which I could reproduce locally. I think https://github.com/theforeman/foreman_discovery/pull/617 fixes that particular test.

ekohl avatar Jan 23 '24 13:01 ekohl

https://github.com/theforeman/foreman_discovery/pull/618 fixes another test that has long been broken.

ekohl avatar Jan 23 '24 15:01 ekohl

I merged fix for broken rake foreman_discovery:test , can you rebase and squash the commits?

stejskalleos avatar Jan 29 '24 08:01 stejskalleos

@stejskalleos I wouldn't squash commits because it's easier to review the changes per cop

ekohl avatar Jan 29 '24 10:01 ekohl

@stejskalleos it is rebased and running on the latest changes.

The checks are failing due to some webpack changes, I have looked into it, this seems like some routing issue and I'm not sure what is the exact issue here. Would you mind taking a look here?

archanaserver avatar Feb 05 '24 18:02 archanaserver

@ekohl i can't find why it is failing clearly, would you please help me here?

Edit: Also I guess foreman_default_hostgroup this repo https://github.com/theforeman/foreman_default_hostgroup/pull/62 also has similar kind of failure https://github.com/theforeman/foreman_default_hostgroup/actions/runs/8135910181/job/22231270234?pr=62

archanaserver avatar Apr 03 '24 13:04 archanaserver

@ekohl @stejskalleos would you mind taking a look on the final changes?

archanaserver avatar May 09 '24 06:05 archanaserver

Thanks @archanaserver @ekohl

stejskalleos avatar May 13 '24 05:05 stejskalleos