Skip to content

Commit

Permalink
Merge pull request #35 from davidharrigan/provide-ssl-config
Browse files Browse the repository at this point in the history
Provide ssl config
  • Loading branch information
jelmersnoeck authored Jan 18, 2019
2 parents 12edec6 + af935cb commit 1778538
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
12 changes: 9 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ required = [
name = "github.com/dchest/blake2b"
version = "1.0.0"

[[constraint]]
name = "github.com/prometheus/client_golang"
version = "0.8.0"

[[constraint]]
branch = "master"
name = "github.com/DreamItGetIT/statuscake"
source = "github.com/manifoldco/statuscake"

[[constraint]]
name = "github.com/prometheus/client_golang"
version = "0.8.0"
1 change: 1 addition & 0 deletions internal/provider/statuscake/statuscake.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (c *Client) translateSpec(spec v1alpha1.MonitorTemplateSpec) (*statuscake.T
scTest.WebsiteURL = http.URL
scTest.FollowRedirect = http.FollowRedirects
scTest.FindString = spec.HTTP.ShouldContain
scTest.EnableSSLAlert = spec.HTTP.VerifyCertificate

if spec.HTTP.ShouldNotContain != "" {
scTest.FindString = spec.HTTP.ShouldNotContain
Expand Down
47 changes: 29 additions & 18 deletions internal/provider/statuscake/statuscake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,20 @@ func TestTranslateSpec(t *testing.T) {
UserAgent: "(Test User Agent)",
WebsiteURL: "http://fully-qualified-url.com",
FollowRedirect: true,
EnableSSLAlert: false,
},
},
{
"HTTP config should contain",
v1alpha1.MonitorTemplateSpec{
Type: "HTTP",
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)",
URL: "http://fully-qualified-url.com",
FollowRedirects: true,
ShouldContain: "this string",
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)",
URL: "http://fully-qualified-url.com",
FollowRedirects: true,
ShouldContain: "this string",
VerifyCertificate: true,
},
},
nil,
Expand All @@ -162,18 +164,20 @@ func TestTranslateSpec(t *testing.T) {
FollowRedirect: true,
FindString: "this string",
DoNotFind: false,
EnableSSLAlert: true,
},
},
{
"HTTP config should not contain",
v1alpha1.MonitorTemplateSpec{
Type: "HTTP",
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)",
URL: "http://fully-qualified-url.com",
FollowRedirects: true,
ShouldNotContain: "this string",
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)",
URL: "http://fully-qualified-url.com",
FollowRedirects: true,
ShouldNotContain: "this string",
VerifyCertificate: true,
},
},
nil,
Expand All @@ -185,17 +189,19 @@ func TestTranslateSpec(t *testing.T) {
FollowRedirect: true,
FindString: "this string",
DoNotFind: true,
EnableSSLAlert: true,
},
},
{
"HTTP config with contact groups",
v1alpha1.MonitorTemplateSpec{
Type: "HTTP",
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)",
URL: "http://fully-qualified-url.com",
FollowRedirects: true,
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)",
URL: "http://fully-qualified-url.com",
FollowRedirects: true,
VerifyCertificate: true,
},
},
[]string{"12345"},
Expand All @@ -206,6 +212,7 @@ func TestTranslateSpec(t *testing.T) {
WebsiteURL: "http://fully-qualified-url.com",
FollowRedirect: true,
ContactGroup: []string{"12345"},
EnableSSLAlert: true,
},
},
}
Expand Down Expand Up @@ -387,7 +394,8 @@ func TestClient_Update(t *testing.T) {
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)", URL: "http://fully-qualified-url.com",
FollowRedirects: true,
FollowRedirects: true,
VerifyCertificate: true,
},
}

Expand Down Expand Up @@ -416,7 +424,8 @@ func TestClient_Update(t *testing.T) {
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)", URL: "http://fully-qualified-url.com",
FollowRedirects: true,
FollowRedirects: true,
VerifyCertificate: true,
},
}

Expand All @@ -437,7 +446,8 @@ func TestClient_Update(t *testing.T) {
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)", URL: "http://fully-qualified-url.com",
FollowRedirects: true,
FollowRedirects: true,
VerifyCertificate: true,
},
}

Expand All @@ -463,7 +473,8 @@ func TestClient_Update(t *testing.T) {
HTTP: &v1alpha1.HTTPTemplate{
CustomHeader: "Test-Header",
UserAgent: "(Test User Agent)", URL: "http://fully-qualified-url.com",
FollowRedirects: true,
FollowRedirects: true,
VerifyCertificate: true,
},
}

Expand Down

0 comments on commit 1778538

Please sign in to comment.