Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 4bd85ae

Browse files
authored
Merge pull request #502 from alexkappa/patch/fix-logstream-tests
Fix log stream tests
2 parents d627fc8 + 1dac2fe commit 4bd85ae

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

auth0/resource_auth0_log_stream_test.go

+22-18
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"strings"
66
"testing"
77

8-
"github.com/alexkappa/terraform-provider-auth0/auth0/internal/random"
98
"github.com/hashicorp/go-multierror"
109
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
1110
"github.com/hashicorp/terraform-plugin-sdk/terraform"
11+
12+
"github.com/alexkappa/terraform-provider-auth0/auth0/internal/random"
1213
)
1314

1415
func init() {
@@ -61,7 +62,7 @@ func TestAccLogStreamHTTP(t *testing.T) {
6162
),
6263
},
6364
{
64-
Config: random.Template(testAccLogStreamHTTPConfigUpdateFormat, rand),
65+
Config: random.Template(testAccLogStreamHTTPConfigUpdateFormatToJSONARRAY, rand),
6566
Check: resource.ComposeTestCheckFunc(
6667
random.TestCheckResourceAttr("auth0_log_stream.my_log_stream", "name", "Acceptance-Test-LogStream-http-{{.random}}", rand),
6768
resource.TestCheckResourceAttr("auth0_log_stream.my_log_stream", "type", "http"),
@@ -72,7 +73,7 @@ func TestAccLogStreamHTTP(t *testing.T) {
7273
),
7374
},
7475
{
75-
Config: random.Template(testAccLogStreamHTTPConfigUpdateJsonObject, rand),
76+
Config: random.Template(testAccLogStreamHTTPConfigUpdateFormatToJSONOBJECT, rand),
7677
Check: resource.ComposeTestCheckFunc(
7778
random.TestCheckResourceAttr("auth0_log_stream.my_log_stream", "name", "Acceptance-Test-LogStream-http-{{.random}}", rand),
7879
resource.TestCheckResourceAttr("auth0_log_stream.my_log_stream", "type", "http"),
@@ -110,38 +111,41 @@ resource "auth0_log_stream" "my_log_stream" {
110111
}
111112
}
112113
`
113-
const testAccLogStreamHTTPConfigUpdate = `
114+
115+
const testAccLogStreamHTTPConfigUpdateFormatToJSONARRAY = `
114116
resource "auth0_log_stream" "my_log_stream" {
115-
name = "Acceptance-Test-LogStream-http-new-{{.random}}"
117+
name = "Acceptance-Test-LogStream-http-{{.random}}"
116118
type = "http"
117119
sink {
118-
http_endpoint = "https://example.com/logs"
119-
http_content_type = "application/json"
120-
http_content_format = "JSONLINES"
120+
http_endpoint = "https://example.com/webhook/logs"
121+
http_content_type = "application/json; charset=utf-8"
122+
http_content_format = "JSONARRAY"
121123
http_authorization = "AKIAXXXXXXXXXXXXXXXX"
122124
}
123125
}
124126
`
125-
const testAccLogStreamHTTPConfigUpdateJsonObject = `
127+
128+
const testAccLogStreamHTTPConfigUpdateFormatToJSONOBJECT = `
126129
resource "auth0_log_stream" "my_log_stream" {
127-
name = "Acceptance-Test-LogStream-http-new-{{.random}}"
130+
name = "Acceptance-Test-LogStream-http-{{.random}}"
128131
type = "http"
129132
sink {
130-
http_endpoint = "https://example.com/logs"
131-
http_content_type = "application/json"
133+
http_endpoint = "https://example.com/webhook/logs"
134+
http_content_type = "application/json; charset=utf-8"
132135
http_content_format = "JSONOBJECT"
133136
http_authorization = "AKIAXXXXXXXXXXXXXXXX"
134137
}
135138
}
136139
`
137-
const testAccLogStreamHTTPConfigUpdateFormat = `
140+
141+
const testAccLogStreamHTTPConfigUpdate = `
138142
resource "auth0_log_stream" "my_log_stream" {
139-
name = "Acceptance-Test-LogStream-http-{{.random}}"
143+
name = "Acceptance-Test-LogStream-http-new-{{.random}}"
140144
type = "http"
141145
sink {
142-
http_endpoint = "https://example.com/webhook/logs"
143-
http_content_type = "application/json; charset=utf-8"
144-
http_content_format = "JSONARRAY"
146+
http_endpoint = "https://example.com/logs"
147+
http_content_type = "application/json"
148+
http_content_format = "JSONLINES"
145149
http_authorization = "AKIAXXXXXXXXXXXXXXXX"
146150
}
147151
}
@@ -217,7 +221,7 @@ resource "auth0_log_stream" "my_log_stream" {
217221
}
218222
`
219223

220-
//This test fails it subscription key is not valid, or Eventgrid Resource Provider is not registered in the subscription
224+
// This test fails it subscription key is not valid, or Eventgrid Resource Provider is not registered in the subscription
221225
func TestAccLogStreamEventGrid(t *testing.T) {
222226
rand := random.String(6)
223227

0 commit comments

Comments
 (0)