@@ -115,6 +115,45 @@ def workflow_kafka_csr_via_ssh_tunnel(c: Composition, redpanda: bool = False) ->
115115 c .run ("testdrive" , "--no-reset" , "kafka-source-after-ssh-restart.td" )
116116
117117
118+ def workflow_hidden_hosts (c : Composition , redpanda : bool = False ) -> None :
119+ c .down ()
120+ dependencies = ["materialized" , "ssh-bastion-host" ]
121+ if redpanda :
122+ dependencies += ["redpanda" ]
123+ else :
124+ dependencies += ["zookeeper" , "kafka" , "schema-registry" ]
125+ c .up (* dependencies )
126+
127+ c .run ("testdrive" , "setup.td" )
128+
129+ public_key = c .sql_query ("select public_key_1 from mz_ssh_tunnel_connections;" )[0 ][
130+ 0
131+ ]
132+
133+ c .exec (
134+ "ssh-bastion-host" ,
135+ "bash" ,
136+ "-c" ,
137+ f"echo '{ public_key } ' > /etc/authorized_keys/mz" ,
138+ )
139+
140+ def add_hidden_host (container : str ) -> None :
141+ ip = c .exec (
142+ "ssh-bastion-host" , "getent" , "hosts" , container , capture = True
143+ ).stdout .split (" " )[0 ]
144+ c .exec (
145+ "ssh-bastion-host" ,
146+ "bash" ,
147+ "-c" ,
148+ f"echo '{ ip } hidden-{ container } ' >> /etc/hosts" ,
149+ )
150+
151+ add_hidden_host ("kafka" )
152+ add_hidden_host ("schema-registry" )
153+
154+ c .run ("testdrive" , "--no-reset" , "hidden-hosts.td" )
155+
156+
118157# Test that if we restart the bastion AND change its server keys(s), we can
119158# still reconnect in the replication stream.
120159def workflow_pg_restart_bastion (c : Composition ) -> None :
@@ -268,3 +307,4 @@ def workflow_default(c: Composition) -> None:
268307 workflow_pg_via_ssh_tunnel (c )
269308 workflow_pg_via_ssh_tunnel_with_ssl (c )
270309 workflow_pg_restart_bastion (c )
310+ workflow_hidden_hosts (c )
0 commit comments