Re: /etc/hosts setting in RPM spec file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Folks, thanks for your responses!

Jeremy,
> That's a bad idea. Changing systemwide hostname resolution for a unit test has huge side effects for a disposable use case. Please don't do this.
>
> It would be better to do something like mock gethostbyname() in a unit test mock resolver .so and use runtime linker hints like LD_PRELOAD to make sure the unit test binary links to the mock instead of the system resolver.

OK. I sent a PR not to use mysql2gem.example.com, but to use
localhost. And applied the patch to the rubygem-mysql2 RPM spec file.
But I understand mocking a part of resolving hosting is even better.
https://github.com/brianmario/mysql2/pull/1296

Fabio,
> It looks like the upstream tests only use this weird setup because they use containers?

No, it's not only for the CI cases using containers but also cases
executed on the upstream GitHub Actions Ubuntu or MacOS. The domain is
used in all the cases of the upstream CI.
In the upstream source, the domain "mysql2gem.example.com" is used to
create the spec/ssl/* files, the SSL certification keys.
https://github.com/brianmario/mysql2/blob/bab4969264250abca836e85a9c332c42be573dfc/spec/ssl/gen_certs.sh#L22
and it is also used in the SSL related unit tests.
https://github.com/brianmario/mysql2/blob/bab4969264250abca836e85a9c332c42be573dfc/spec/mysql2/client_spec.rb#L156

> For running the test suite in the Fedora package, it should be much
easier to patch the test sources to not connect to the
mysql2gem.example.com domain (which requires the /etc/hosts entry,
which you can't do in mock) but to "localhost" or "127.0.0.1" (which
should always work).

Yeah we applied the patch not to connect to the mysql2gem.example.com
domain, but to connect to the localhost domain.

Petr,
> Another reason not to do it: example.com. domain is reserved for documentation purposes. Please do not use in any code or configuration.

OK. I will keep in mind the point.

Frank,
> True, though the same RFC 2606 reserves[1] the ".test" domain for exactly the purpose used here; the only real issue is that they should switch from example.com to example.test. (Or, really, ${ANYTHING}.test.)

Thanks for the primary source about how to use the testing domains!

Jun

-- 
Jun | He - Him | Timezone: UTC+1 or 2, Czech Republic
See <https://www.worldtimebuddy.com/czech-republic-prague-to-utc> for
the timezone.
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux