@@ -456,6 +456,30 @@ func TestIntegration(t *testing.T) {
456
456
457
457
assert .Equal (t , machine .Name , provider .Machine ().Network ().Hostname ())
458
458
})
459
+ t .Run ("HostnameFromInfraName" , func (t * testing.T ) {
460
+ t .Parallel ()
461
+
462
+ namespaceName := setupTest (ctx , t , c )
463
+ cluster := createCluster (ctx , t , c , namespaceName , & capiv1.ClusterSpec {
464
+ ControlPlaneEndpoint : capiv1.APIEndpoint {
465
+ Host : "example.com" ,
466
+ Port : 443 ,
467
+ },
468
+ })
469
+ talosConfig := createTalosConfig (ctx , t , c , namespaceName , bootstrapv1alpha3.TalosConfigSpec {
470
+ GenerateType : talosmachine .TypeControlPlane .String (),
471
+ TalosVersion : TalosVersion ,
472
+ Hostname : bootstrapv1alpha3.HostnameSpec {
473
+ Source : bootstrapv1alpha3 .HostnameSourceInfrastructureName ,
474
+ },
475
+ })
476
+ machine := createMachine (ctx , t , c , cluster , talosConfig , true )
477
+ waitForReady (ctx , t , c , talosConfig )
478
+
479
+ provider := assertMachineConfiguration (ctx , t , c , talosConfig )
480
+
481
+ assert .Equal (t , machine .Spec .InfrastructureRef .Name , provider .Machine ().Network ().Hostname ())
482
+ })
459
483
t .Run ("TalosConfigValidate" , func (t * testing.T ) {
460
484
t .Parallel ()
461
485
0 commit comments