@@ -9,22 +9,17 @@ import (
99 "testing"
1010
1111 "github.com/cloudfoundry/stratos/src/jetstream/plugins/cfappssh"
12- "github.com/labstack/echo/v4"
1312)
1413
15- type FakeContext struct {
16- echo.Context
17- }
18-
1914func TestCheckForV3Availability (t * testing.T ) {
2015 expectedProcessID := "i-am-process-id"
2116 appGUID := "some-guid"
2217
23- testServer := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ){
18+ testServer := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
2419 appWebProcess := map [string ]string {
2520 "AppGUID" : "one two three" ,
26- "guid" : "i-am-process-id" ,
27- "Type" : "web" ,
21+ "guid" : "i-am-process-id" ,
22+ "Type" : "web" ,
2823 }
2924 re := regexp .MustCompile ("^/v3" )
3025
@@ -48,7 +43,7 @@ func TestCheckForV3Availability(t *testing.T) {
4843 apiClient := http.Client {}
4944 processID , err := cfappssh .CheckForV3AvailabilityAndReturnProcessID (appGUID , testServer .URL , "" ,"" , apiClient )
5045 if err != nil {
51- t .Errorf ("I didn't expect that: %s" ,err )
46+ t .Errorf ("I didn't expect that: %s" , err )
5247 }
5348 if processID != expectedProcessID {
5449 t .Errorf ("the value should have changed to %s but was %s" , expectedProcessID , appGUID )
@@ -62,6 +57,7 @@ func TestV2InstanceWebProcessSSH(t *testing.T) {
6257
6358 testServer := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
6459 re := regexp .MustCompile ("^/v3" )
60+ t .Log ("path" , r .URL .Path , "method" , r .Method )
6561
6662 if re .Match ([]byte (r .URL .Path )) && r .Method == http .MethodHead {
6763 w .WriteHeader (http .StatusNotFound )
@@ -73,7 +69,7 @@ func TestV2InstanceWebProcessSSH(t *testing.T) {
7369 apiClient := http.Client {}
7470 processID , err := cfappssh .CheckForV3AvailabilityAndReturnProcessID (appGUID , testServer .URL , "" ,"" , apiClient )
7571 if err != nil {
76- t .Errorf ("I didn't expect that: %s" ,err )
72+ t .Errorf ("I didn't expect that: %s" , err )
7773 }
7874 if processID != expectedProcessID {
7975 t .Errorf ("the value should NOT have changed. expected %s but was %s" , expectedProcessID , processID )
0 commit comments