2929 testenv env.Environment
3030 testOrgName = "cf-ci-e2e"
3131 testDomain = "e2e.orchestrator.io"
32- testHostName = "app-host "
32+ testAppDomain = "cfapps.eu12.hana.ondemand.com "
3333 testSpaceName = "e2e-space"
3434 testQuotaName = "e2e-space-quota"
3535)
@@ -44,7 +44,10 @@ func resetTestOrg(ctx context.Context, t *testing.T) {
4444 if err != nil {
4545 t .Fatalf ("test org %s not accessible" , testOrgName )
4646 }
47- _ = deleteDomainRoute (ctx , cfClient , org , testDomain , testHostName )
47+ _ = deleteRoute (ctx , cfClient , org , testDomain , "app-host" )
48+ _ = deleteRoute (ctx , cfClient , org , testAppDomain , "app-route-host-domainref" )
49+ _ = deleteRoute (ctx , cfClient , org , testAppDomain , "app-route-host-domainname" )
50+ _ = deleteDomain (ctx , cfClient , org , testDomain )
4851 _ = deleteSpace (ctx , cfClient , org , testSpaceName )
4952 _ = deleteQuota (ctx , cfClient , org , testQuotaName )
5053}
@@ -105,14 +108,26 @@ func deleteSpace(ctx context.Context, cfClient *client.Client, org string, space
105108
106109}
107110
108- func deleteDomainRoute (ctx context.Context , cfClient * client.Client , org string , domain string , route string ) error {
111+ func deleteDomain (ctx context.Context , cfClient * client.Client , org string , domain string ) error {
112+ d , err := cfClient .Domains .Single (ctx ,
113+ & client.DomainListOptions {
114+ OrganizationGUIDs : client.Filter {Values : []string {org }},
115+ Names : client.Filter {Values : []string {domain }},
116+ })
117+ if err == nil {
118+ _ , err = cfClient .Domains .Delete (ctx , d .GUID )
119+ return err
120+ }
121+ return err
122+ }
123+
124+ func deleteRoute (ctx context.Context , cfClient * client.Client , org string , domain string , route string ) error {
109125 d , err := cfClient .Domains .Single (ctx ,
110126 & client.DomainListOptions {
111127 OrganizationGUIDs : client.Filter {Values : []string {org }},
112128 Names : client.Filter {Values : []string {domain }},
113129 })
114130 if err == nil {
115- klog .V (4 ).Info ("found test domain! cleaning up" )
116131 s , err := cfClient .Routes .Single (ctx ,
117132 & client.RouteListOptions {
118133 OrganizationGUIDs : client.Filter {Values : []string {org }},
@@ -125,12 +140,10 @@ func deleteDomainRoute(ctx context.Context, cfClient *client.Client, org string,
125140 _ , err = cfClient .Routes .Delete (ctx , s .GUID )
126141 return err
127142 }
128- _ , err = cfClient .Domains .Delete (ctx , d .GUID )
129- return err
143+ return nil
130144 }
131- return nil
145+ return err
132146}
133-
134147func deleteQuota (ctx context.Context , cfClient * client.Client , org string , quota string ) error {
135148 s , err := cfClient .SpaceQuotas .Single (ctx ,
136149 & client.SpaceQuotaListOptions {
0 commit comments