@@ -1557,15 +1557,19 @@ func TestTunnelAllWorkspaceUpdatesController_Initial(t *testing.T) {
1557
1557
require .Contains (t ,adds ,w2a1ID )
1558
1558
require .Contains (t ,adds ,w2a2ID )
1559
1559
1560
+ ws1a1IP := netip .MustParseAddr ("fd60:627a:a42b:0101::" )
1561
+ w2a1IP := netip .MustParseAddr ("fd60:627a:a42b:0201::" )
1562
+ w2a2IP := netip .MustParseAddr ("fd60:627a:a42b:0202::" )
1563
+
1560
1564
// Also triggers setting DNS hosts
1561
1565
expectedDNS := map [dnsname.FQDN ][]netip.Addr {
1562
- "w1a1.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1563
- "w2a1.w2.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0201::" ) },
1564
- "w2a2.w2.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0202::" ) },
1565
- "w1a1.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1566
- "w2a1.w2.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0201::" ) },
1567
- "w2a2.w2.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0202::" ) },
1568
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1566
+ "w1a1.w1.me.coder." : {ws1a1IP },
1567
+ "w2a1.w2.me.coder." : {w2a1IP },
1568
+ "w2a2.w2.me.coder." : {w2a2IP },
1569
+ "w1a1.w1.testy.coder." : {ws1a1IP },
1570
+ "w2a1.w2.testy.coder." : {w2a1IP },
1571
+ "w2a2.w2.testy.coder." : {w2a2IP },
1572
+ "w1.coder." : {ws1a1IP },
1569
1573
}
1570
1574
dnsCall := testutil .RequireRecvCtx (ctx ,t ,fDNS .calls )
1571
1575
require .Equal (t ,expectedDNS ,dnsCall .hosts )
@@ -1580,23 +1584,23 @@ func TestTunnelAllWorkspaceUpdatesController_Initial(t *testing.T) {
1580
1584
{
1581
1585
ID :w1a1ID ,Name :"w1a1" ,WorkspaceID :w1ID ,
1582
1586
Hosts :map [dnsname.FQDN ][]netip.Addr {
1583
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1584
- "w1a1.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1585
- "w1a1.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1587
+ "w1.coder." : {ws1a1IP },
1588
+ "w1a1.w1.me.coder." : {ws1a1IP },
1589
+ "w1a1.w1.testy.coder." : {ws1a1IP },
1586
1590
},
1587
1591
},
1588
1592
{
1589
1593
ID :w2a1ID ,Name :"w2a1" ,WorkspaceID :w2ID ,
1590
1594
Hosts :map [dnsname.FQDN ][]netip.Addr {
1591
- "w2a1.w2.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0201::" ) },
1592
- "w2a1.w2.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0201::" ) },
1595
+ "w2a1.w2.me.coder." : {w2a1IP },
1596
+ "w2a1.w2.testy.coder." : {w2a1IP },
1593
1597
},
1594
1598
},
1595
1599
{
1596
1600
ID :w2a2ID ,Name :"w2a2" ,WorkspaceID :w2ID ,
1597
1601
Hosts :map [dnsname.FQDN ][]netip.Addr {
1598
- "w2a2.w2.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0202::" ) },
1599
- "w2a2.w2.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0202::" ) },
1602
+ "w2a2.w2.me.coder." : {w2a2IP },
1603
+ "w2a2.w2.testy.coder." : {w2a2IP },
1600
1604
},
1601
1605
},
1602
1606
},
@@ -1635,6 +1639,9 @@ func TestTunnelAllWorkspaceUpdatesController_DeleteAgent(t *testing.T) {
1635
1639
w1ID := testUUID (1 )
1636
1640
w1a1ID := testUUID (1 ,1 )
1637
1641
w1a2ID := testUUID (1 ,2 )
1642
+ ws1a1IP := netip .MustParseAddr ("fd60:627a:a42b:0101::" )
1643
+ ws1a2IP := netip .MustParseAddr ("fd60:627a:a42b:0102::" )
1644
+
1638
1645
initUp := & proto.WorkspaceUpdate {
1639
1646
UpsertedWorkspaces : []* proto.Workspace {
1640
1647
{Id :w1ID [:],Name :"w1" },
@@ -1654,9 +1661,9 @@ func TestTunnelAllWorkspaceUpdatesController_DeleteAgent(t *testing.T) {
1654
1661
1655
1662
// DNS for w1a1
1656
1663
expectedDNS := map [dnsname.FQDN ][]netip.Addr {
1657
- "w1a1.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1658
- "w1a1.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1659
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1664
+ "w1a1.w1.testy.coder." : {ws1a1IP },
1665
+ "w1a1.w1.me.coder." : {ws1a1IP },
1666
+ "w1.coder." : {ws1a1IP },
1660
1667
}
1661
1668
dnsCall := testutil .RequireRecvCtx (ctx ,t ,fDNS .calls )
1662
1669
require .Equal (t ,expectedDNS ,dnsCall .hosts )
@@ -1668,9 +1675,9 @@ func TestTunnelAllWorkspaceUpdatesController_DeleteAgent(t *testing.T) {
1668
1675
},
1669
1676
UpsertedAgents : []* tailnet.Agent {
1670
1677
{ID :w1a1ID ,Name :"w1a1" ,WorkspaceID :w1ID ,Hosts :map [dnsname.FQDN ][]netip.Addr {
1671
- "w1a1.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1672
- "w1a1.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1673
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1678
+ "w1a1.w1.testy.coder." : {ws1a1IP },
1679
+ "w1a1.w1.me.coder." : {ws1a1IP },
1680
+ "w1.coder." : {ws1a1IP },
1674
1681
}},
1675
1682
},
1676
1683
DeletedWorkspaces : []* tailnet.Workspace {},
@@ -1709,9 +1716,9 @@ func TestTunnelAllWorkspaceUpdatesController_DeleteAgent(t *testing.T) {
1709
1716
1710
1717
// DNS contains only w1a2
1711
1718
expectedDNS = map [dnsname.FQDN ][]netip.Addr {
1712
- "w1a2.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1713
- "w1a2.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1714
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1719
+ "w1a2.w1.testy.coder." : {ws1a2IP },
1720
+ "w1a2.w1.me.coder." : {ws1a2IP },
1721
+ "w1.coder." : {ws1a2IP },
1715
1722
}
1716
1723
dnsCall = testutil .RequireRecvCtx (ctx ,t ,fDNS .calls )
1717
1724
require .Equal (t ,expectedDNS ,dnsCall .hosts )
@@ -1722,17 +1729,17 @@ func TestTunnelAllWorkspaceUpdatesController_DeleteAgent(t *testing.T) {
1722
1729
UpsertedWorkspaces : []* tailnet.Workspace {},
1723
1730
UpsertedAgents : []* tailnet.Agent {
1724
1731
{ID :w1a2ID ,Name :"w1a2" ,WorkspaceID :w1ID ,Hosts :map [dnsname.FQDN ][]netip.Addr {
1725
- "w1a2.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1726
- "w1a2.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1727
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1732
+ "w1a2.w1.testy.coder." : {ws1a2IP },
1733
+ "w1a2.w1.me.coder." : {ws1a2IP },
1734
+ "w1.coder." : {ws1a2IP },
1728
1735
}},
1729
1736
},
1730
1737
DeletedWorkspaces : []* tailnet.Workspace {},
1731
1738
DeletedAgents : []* tailnet.Agent {
1732
1739
{ID :w1a1ID ,Name :"w1a1" ,WorkspaceID :w1ID ,Hosts :map [dnsname.FQDN ][]netip.Addr {
1733
- "w1a1.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1734
- "w1a1.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1735
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1740
+ "w1a1.w1.testy.coder." : {ws1a1IP },
1741
+ "w1a1.w1.me.coder." : {ws1a1IP },
1742
+ "w1.coder." : {ws1a1IP },
1736
1743
}},
1737
1744
},
1738
1745
}
@@ -1746,9 +1753,9 @@ func TestTunnelAllWorkspaceUpdatesController_DeleteAgent(t *testing.T) {
1746
1753
},
1747
1754
UpsertedAgents : []* tailnet.Agent {
1748
1755
{ID :w1a2ID ,Name :"w1a2" ,WorkspaceID :w1ID ,Hosts :map [dnsname.FQDN ][]netip.Addr {
1749
- "w1a2.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1750
- "w1a2.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1751
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0102::" ) },
1756
+ "w1a2.w1.testy.coder." : {ws1a2IP },
1757
+ "w1a2.w1.me.coder." : {ws1a2IP },
1758
+ "w1.coder." : {ws1a2IP },
1752
1759
}},
1753
1760
},
1754
1761
DeletedWorkspaces : []* tailnet.Workspace {},
@@ -1776,6 +1783,8 @@ func TestTunnelAllWorkspaceUpdatesController_DNSError(t *testing.T) {
1776
1783
1777
1784
w1ID := testUUID (1 )
1778
1785
w1a1ID := testUUID (1 ,1 )
1786
+ ws1a1IP := netip .MustParseAddr ("fd60:627a:a42b:0101::" )
1787
+
1779
1788
initUp := & proto.WorkspaceUpdate {
1780
1789
UpsertedWorkspaces : []* proto.Workspace {
1781
1790
{Id :w1ID [:],Name :"w1" },
@@ -1789,9 +1798,9 @@ func TestTunnelAllWorkspaceUpdatesController_DNSError(t *testing.T) {
1789
1798
1790
1799
// DNS for w1a1
1791
1800
expectedDNS := map [dnsname.FQDN ][]netip.Addr {
1792
- "w1a1.w1.me.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1793
- "w1a1.w1.testy.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1794
- "w1.coder." : {netip . MustParseAddr ( "fd60:627a:a42b:0101::" ) },
1801
+ "w1a1.w1.me.coder." : {ws1a1IP },
1802
+ "w1a1.w1.testy.coder." : {ws1a1IP },
1803
+ "w1.coder." : {ws1a1IP },
1795
1804
}
1796
1805
dnsCall := testutil .RequireRecvCtx (ctx ,t ,fDNS .calls )
1797
1806
require .Equal (t ,expectedDNS ,dnsCall .hosts )