@@ -1556,17 +1556,18 @@ func TestAPI(t *testing.T) {
1556
1556
}
1557
1557
1558
1558
tests := []struct {
1559
- name string
1560
- customization []agentcontainers.CoderCustomization
1561
- afterCreate func (t * testing.T , subAgent agentcontainers.SubAgent )
1559
+ name string
1560
+ customization agentcontainers.CoderCustomization
1561
+ mergedCustomizations []agentcontainers.CoderCustomization
1562
+ afterCreate func (t * testing.T , subAgent agentcontainers.SubAgent )
1562
1563
}{
1563
1564
{
1564
- name : "WithoutCustomization" ,
1565
- customization : nil ,
1565
+ name : "WithoutCustomization" ,
1566
+ mergedCustomizations : nil ,
1566
1567
},
1567
1568
{
1568
- name : "WithDefaultDisplayApps" ,
1569
- customization : []agentcontainers.CoderCustomization {},
1569
+ name : "WithDefaultDisplayApps" ,
1570
+ mergedCustomizations : []agentcontainers.CoderCustomization {},
1570
1571
afterCreate : func (t * testing.T , subAgent agentcontainers.SubAgent ) {
1571
1572
require .Len (t , subAgent .DisplayApps , 4 )
1572
1573
assert .Contains (t , subAgent .DisplayApps , codersdk .DisplayAppVSCodeDesktop )
@@ -1577,7 +1578,7 @@ func TestAPI(t *testing.T) {
1577
1578
},
1578
1579
{
1579
1580
name : "WithAllDisplayApps" ,
1580
- customization : []agentcontainers.CoderCustomization {
1581
+ mergedCustomizations : []agentcontainers.CoderCustomization {
1581
1582
{
1582
1583
DisplayApps : map [codersdk.DisplayApp ]bool {
1583
1584
codersdk .DisplayAppSSH : true ,
@@ -1599,7 +1600,7 @@ func TestAPI(t *testing.T) {
1599
1600
},
1600
1601
{
1601
1602
name : "WithSomeDisplayAppsDisabled" ,
1602
- customization : []agentcontainers.CoderCustomization {
1603
+ mergedCustomizations : []agentcontainers.CoderCustomization {
1603
1604
{
1604
1605
DisplayApps : map [codersdk.DisplayApp ]bool {
1605
1606
codersdk .DisplayAppSSH : false ,
@@ -1631,7 +1632,7 @@ func TestAPI(t *testing.T) {
1631
1632
},
1632
1633
{
1633
1634
name : "WithApps" ,
1634
- customization : []agentcontainers.CoderCustomization {
1635
+ mergedCustomizations : []agentcontainers.CoderCustomization {
1635
1636
{
1636
1637
Apps : []agentcontainers.SubAgentApp {
1637
1638
{
@@ -1699,7 +1700,7 @@ func TestAPI(t *testing.T) {
1699
1700
},
1700
1701
{
1701
1702
name : "AppDeduplication" ,
1702
- customization : []agentcontainers.CoderCustomization {
1703
+ mergedCustomizations : []agentcontainers.CoderCustomization {
1703
1704
{
1704
1705
Apps : []agentcontainers.SubAgentApp {
1705
1706
{
@@ -1741,47 +1742,45 @@ func TestAPI(t *testing.T) {
1741
1742
},
1742
1743
{
1743
1744
name : "Name" ,
1744
- customization : []agentcontainers.CoderCustomization {
1745
+ customization : agentcontainers.CoderCustomization {
1746
+ Name : "this-name" ,
1747
+ },
1748
+ mergedCustomizations : []agentcontainers.CoderCustomization {
1745
1749
{
1746
1750
Name : "not-this-name" ,
1747
1751
},
1748
1752
{
1749
- Name : "custom -name" ,
1753
+ Name : "or-this -name" ,
1750
1754
},
1751
1755
},
1752
1756
afterCreate : func (t * testing.T , subAgent agentcontainers.SubAgent ) {
1753
- require .Equal (t , "custom -name" , subAgent .Name )
1757
+ require .Equal (t , "this -name" , subAgent .Name )
1754
1758
},
1755
1759
},
1756
1760
{
1757
- name : "NameIsOnlyUsedWhenInLastLayer " ,
1758
- customization : []agentcontainers.CoderCustomization {
1761
+ name : "NameIsOnlyUsedFromRoot " ,
1762
+ mergedCustomizations : []agentcontainers.CoderCustomization {
1759
1763
{
1760
1764
Name : "custom-name" ,
1761
1765
},
1762
- {},
1763
1766
},
1764
1767
afterCreate : func (t * testing.T , subAgent agentcontainers.SubAgent ) {
1765
1768
require .NotEqual (t , "custom-name" , subAgent .Name )
1766
1769
},
1767
1770
},
1768
1771
{
1769
1772
name : "EmptyNameIsIgnored" ,
1770
- customization : []agentcontainers.CoderCustomization {
1771
- {
1772
- Name : "" ,
1773
- },
1773
+ customization : agentcontainers.CoderCustomization {
1774
+ Name : "" ,
1774
1775
},
1775
1776
afterCreate : func (t * testing.T , subAgent agentcontainers.SubAgent ) {
1776
1777
require .NotEmpty (t , subAgent .Name )
1777
1778
},
1778
1779
},
1779
1780
{
1780
1781
name : "InvalidNameIsIgnored" ,
1781
- customization : []agentcontainers.CoderCustomization {
1782
- {
1783
- Name : "This--Is_An_Invalid--Name" ,
1784
- },
1782
+ customization : agentcontainers.CoderCustomization {
1783
+ Name : "This--Is_An_Invalid--Name" ,
1785
1784
},
1786
1785
afterCreate : func (t * testing.T , subAgent agentcontainers.SubAgent ) {
1787
1786
require .NotEqual (t , "This--Is_An_Invalid--Name" , subAgent .Name )
@@ -1804,11 +1803,16 @@ func TestAPI(t *testing.T) {
1804
1803
}
1805
1804
fDCCLI = & fakeDevcontainerCLI {
1806
1805
readConfig : agentcontainers.DevcontainerConfig {
1807
- MergedConfiguration : agentcontainers.DevcontainerConfiguration {
1806
+ Configuration : agentcontainers.DevcontainerConfiguration {
1808
1807
Customizations : agentcontainers.DevcontainerCustomizations {
1809
1808
Coder : tt .customization ,
1810
1809
},
1811
1810
},
1811
+ MergedConfiguration : agentcontainers.DevcontainerMergedConfiguration {
1812
+ Customizations : agentcontainers.DevcontainerMergedCustomizations {
1813
+ Coder : tt .mergedCustomizations ,
1814
+ },
1815
+ },
1812
1816
},
1813
1817
execErrC : make (chan func (cmd string , args ... string ) error , 1 ),
1814
1818
}
0 commit comments