[ 
https://issues.apache.org/jira/browse/CASSANDRA-15901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17150084#comment-17150084
 ] 

Robert Stupp commented on CASSANDRA-15901:
------------------------------------------

Well, the most unintrusive way would be to add the hostname to the 127.0.0.1 
(or even better the host's public IP) entry in /etc/hosts.

Mosts tests in question (e.g. theĀ {{ReplicaCollectionTest}} or 
{{SEPExecutorTest}}) do not need a c-yaml at all (and didn't need it before), 
because those are "pure" unit tests (i.e. don't need a daemon or any 
configuration). Other tests (like the {{DatabaseDescriptorRefTest}}) are 
"allergic" to touching classes before the actual test. The next guy who comes 
along these tests, likely thinks that the DD call is unnecessary and removes 
it, because the test passes locally and e.g. in CircleCI.

The change to {{DatabaseDescriptorRefTest}} actually causes the test to not 
fully exercise the DD-init code being tested (and "silently pass" although it 
didn't test the whole init code or, if new changes get in, fail because some 
expectations aren't met). TL;DR it breaks that test.

The implemented default for {{broadcast_address}} (defaulting to 
{{listen_address}}, which in turn defaults to {{InetAddress.getLocalHost()}}), 
is correct (the yaml says: _"{{Leaving it blank leaves it up to 
InetAddress.getLocalHost(). This will always do the Right Thing *if the node is 
properly configured (hostname, name resolution, etc)*, and the Right Thing is 
to use the address associated with the hostname (it might not be).}}"_). I 
admit, it might be wrong to add a fallback to 
{{InetAddress.getLoopbackAddress()}}.

TL;DR I think it's much safer to fix the test environment (and not work around 
test environment issues by changing any existing code).

Side note (feel free to ignore this): I do think that using 
{{InetAddress.getLocalHost()}} is a mistake in general. It seems that (in 
practice) there is no guarantee that it {{IA.getLocalHost()}} deterministically 
return the same address - think: DHCP changes, interfaces going up or down, 
hostnames that resolve to multiple IPs, etc etc.

> Fix unit tests to load test/conf/cassandra.yaml (so to listen on a valid ip)
> ----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15901
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15901
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/dtest
>            Reporter: Berenguer Blasi
>            Assignee: Berenguer Blasi
>            Priority: Normal
>             Fix For: 4.0-rc
>
>
> Many of the ci-cassandra jenkins runs fail on {{ip-10-0-5-5: Name or service 
> not known}}. CASSANDRA-15622 addressed some of these but many still remain. 
> Currently test C* nodes are either failing or listening on a public ip 
> depending on which agent they end up.
> The idea behind this ticket is to make ant force the private VPC ip in the 
> cassandra yaml when building, this will force the nodes to listen on the 
> correct ip.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to