-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updating. * updating to use homebrew as part of release. * Added basic assemble headless fn. * removed unused heroku config. * Added mirrors for headless. Copied the way VDC was used. * have us-east tunnel endpoint working. * Added headless to the 'all' dc tests.
- Loading branch information
Showing
6 changed files
with
137 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package diagnostics | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
"os" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
// HeadlessServices sends HTTP requests to Headless Sauce endpoints to prove | ||
// tests could theoretically be created and the data centers are reachable | ||
func HeadlessServices(sauceEndpoints []string) { | ||
for _, endpoint := range sauceEndpoints { | ||
u, err := url.ParseRequestURI(endpoint) | ||
if err != nil { | ||
log.WithFields(log.Fields{ | ||
"err": err, | ||
"endpoint": endpoint, | ||
}).Debug("Could not parse endpoint.") | ||
fmt.Printf("[ ] %s is not reachable. Err: %v\n", endpoint, err) | ||
continue | ||
} | ||
log.WithFields(log.Fields{ | ||
"url": u, | ||
"IsAbs?": u.IsAbs(), | ||
"scheme": u.Scheme, | ||
"port": u.Port, | ||
"path": u.Path, | ||
}).Debug("URL after Parsing") | ||
|
||
log.Debug("Sending GET req to ", u) | ||
resp, err := http.Get(u.String()) | ||
if err != nil { | ||
fmt.Printf("[ ] %s not reachable\n", u) | ||
log.WithFields(log.Fields{ | ||
"error": err, | ||
"endpoint": u, | ||
}).Infof("[ ] %s not reachable\n", u) | ||
} | ||
|
||
if err == nil { | ||
respOutput(resp, endpoint) | ||
} | ||
} | ||
} | ||
|
||
// HeadlessAPI connects to Headless (us-east-1) REST endpoints to make sure | ||
// 1) credentials work | ||
// 2) api is reachable | ||
// 3) api retrieves the expected data if 1 & 2 are true | ||
func HeadlessAPI(vdcRESTEndpoints []string) { | ||
log.Debug("Sending out HTTP reqs to these endpoints: ", vdcRESTEndpoints) | ||
username := os.Getenv("SAUCE_USERNAME") | ||
apiKey := os.Getenv("SAUCE_ACCESS_KEY") | ||
for _, endpoint := range vdcRESTEndpoints { | ||
log.Debug("Sending GET req to ", endpoint) | ||
var jsonBody = []byte(`{}`) | ||
req, err := http.NewRequest("GET", endpoint, bytes.NewBuffer(jsonBody)) | ||
req.SetBasicAuth(username, apiKey) | ||
req.Header.Set("Content-Type", "application/json") | ||
|
||
client := &http.Client{} | ||
resp, err := client.Do(req) | ||
if err != nil { | ||
fmt.Printf("[ ] %s not reachable\n", endpoint) | ||
log.WithFields(log.Fields{ | ||
"error": err, | ||
}).Infof("[ ] %s not reachable\n", endpoint) | ||
} | ||
|
||
if err == nil { | ||
respOutput(resp, endpoint) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.