Skip to content

Commit 3d03a07

Browse files
committed
Review comments
1 parent 37d1491 commit 3d03a07

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

sumologic/resource_sumologic_source_template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func resourceSumologicSourceTemplate() *schema.Resource {
7171
"version": {
7272
Type: schema.TypeString,
7373
Optional: true,
74+
Computed: true,
7475
},
7576

7677
"latest_version": {

sumologic/resource_sumologic_source_template_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
func TestAccSumologicSourceTemplate_basic(t *testing.T) {
2424
var sourceTemplate SourceTemplate
25-
testSchemaRef := "type = \"Mac2\" \n version = \"1.0.2\" "
25+
testSchemaRef := "type = \"Mac\""
2626

2727
testSelector :=
2828
"tags = [\n[\n{\n key = \"tag\"\n values= [\"Value\"]\n}\n]\n] \n names = [\"TestCollector1\"]"
@@ -49,7 +49,7 @@ func TestAccSumologicSourceTemplate_basic(t *testing.T) {
4949

5050
func TestAccSumologicSourceTemplate_create(t *testing.T) {
5151
var sourceTemplate SourceTemplate
52-
testSchemaRef := "type = \"Mac2\" \n version = \"1.0.2\" "
52+
testSchemaRef := "type = \"Mac\""
5353
testSelector := "tags = [\n[\n{\n key = \"tag\"\n values= [\"Value\"]\n}\n]\n]\n names = [\"TestCollector1\"]"
5454

5555
testInputJson := "jsonencode({\n\"name\": \"hostmetrics_test_source_template_acc\",\n\"description\": \"Host metric source\" ,\n\"receivers\": {\n\"hostmetrics\": {\n\"receiverType\": \"hostmetrics\",\n\"collection_interval\": \"5m\",\n\"cpu_scraper_enabled\": true,\n\"disk_scraper_enabled\": true,\n\"load_scraper_enabled\": true,\n\"filesystem_scraper_enabled\": true,\n\"memory_scraper_enabled\": true,\n\"network_scraper_enabled\": true,\n\"process_scraper_enabled\": true,\n\"paging_scraper_enabled\": true\n}\n},\n\"processors\": {\n\"resource\": {\n\"processorType\": \"resource\",\n\"user_attributes\": [\n{\n\"key\": \"_sourceCategory\",\n\"value\": \"otel/host\"\n}\n],\n\"default_attributes\": [\n{\n\"key\": \"sumo.datasource\",\n\"value\": \"apache\"\n},\n]\n}\n}\n})"
@@ -64,8 +64,7 @@ func TestAccSumologicSourceTemplate_create(t *testing.T) {
6464
Check: resource.ComposeTestCheckFunc(
6565
testAccCheckSourceTemplateExists("sumologic_source_template.test", &sourceTemplate, t),
6666
testAccCheckSourceTemplateAttributes("sumologic_source_template.test"),
67-
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.type", "Mac2"),
68-
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.version", "1.0.2"),
67+
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.type", "Mac"),
6968
resource.TestCheckResourceAttr("sumologic_source_template.test", "selector.0.names.0", "TestCollector1"),
7069
),
7170
},
@@ -76,11 +75,11 @@ func TestAccSumologicSourceTemplate_create(t *testing.T) {
7675
func TestAccSumologicSourceTemplate_update(t *testing.T) {
7776
var sourceTemplate SourceTemplate
7877

79-
testSchemaRef := "type = \"Mac2\" \n version = \"1.0.2\" "
78+
testSchemaRef := "type = \"Mac\""
8079
testSelector := "tags = [\n[\n{\n key = \"tag\"\n values= [\"Value\"]\n}\n]\n]"
8180
testInputJson := "jsonencode({\n\"name\": \"hostmetrics_test_source_template_acc\",\n\"description\": \"Host metric source\" ,\n\"receivers\": {\n\"hostmetrics\": {\n\"receiverType\": \"hostmetrics\",\n\"collection_interval\": \"5m\",\n\"cpu_scraper_enabled\": true,\n\"disk_scraper_enabled\": true,\n\"load_scraper_enabled\": true,\n\"filesystem_scraper_enabled\": true,\n\"memory_scraper_enabled\": true,\n\"network_scraper_enabled\": true,\n\"process_scraper_enabled\": true,\n\"paging_scraper_enabled\": true\n}\n},\n\"processors\": {\n\"resource\": {\n\"processorType\": \"resource\",\n\"user_attributes\": [\n{\n\"key\": \"_sourceCategory\",\n\"value\": \"otel/host\"\n}\n],\n\"default_attributes\": [\n{\n\"key\": \"sumo.datasource\",\n\"value\": \"apache\"\n},\n]\n}\n}\n})"
8281

83-
testUpdatedSchemaRef := "type = \"Mac2\" \n version = \"1.0.2\" "
82+
testUpdatedSchemaRef := "type = \"Mac\""
8483
testUpdatedSelector := "tags = [\n[\n{\n key = \"updatedTag\"\n values= [\"Value\"]\n}\n]\n] \n names = [\"TestCollector1\"]"
8584
testUpdatedInputJson := "jsonencode({\n\"name\": \"hostmetrics_test_source_template_acc\",\n\"description\": \"Host metric source\" ,\n\"receivers\": {\n\"hostmetrics\": {\n\"receiverType\": \"hostmetrics\",\n\"collection_interval\": \"5m\",\n\"cpu_scraper_enabled\": true,\n\"disk_scraper_enabled\": true,\n\"load_scraper_enabled\": true,\n\"filesystem_scraper_enabled\": true,\n\"memory_scraper_enabled\": true,\n\"network_scraper_enabled\": true,\n\"process_scraper_enabled\": true,\n\"paging_scraper_enabled\": true\n}\n},\n\"processors\": {\n\"resource\": {\n\"processorType\": \"resource\",\n\"user_attributes\": [\n{\n\"key\": \"_sourceCategory\",\n\"value\": \"otel/hostupdated\"\n}\n],\n\"default_attributes\": [\n{\n\"key\": \"sumo.datasource\",\n\"value\": \"apache\"\n},\n]\n}\n}\n})"
8685

@@ -94,16 +93,14 @@ func TestAccSumologicSourceTemplate_update(t *testing.T) {
9493
Check: resource.ComposeTestCheckFunc(
9594
testAccCheckSourceTemplateExists("sumologic_source_template.test", &sourceTemplate, t),
9695
testAccCheckSourceTemplateAttributes("sumologic_source_template.test"),
97-
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.type", "Mac2"),
98-
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.version", "1.0.2"),
96+
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.type", "Mac"),
9997
resource.TestCheckResourceAttr("sumologic_source_template.test", "selector.0.tags.0.0.key", "tag"),
10098
),
10199
},
102100
{
103101
Config: testAccSumologicSourceTemplateUpdate(testUpdatedSchemaRef, testUpdatedSelector, testUpdatedInputJson),
104102
Check: resource.ComposeTestCheckFunc(
105-
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.type", "Mac2"),
106-
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.version", "1.0.2"),
103+
resource.TestCheckResourceAttr("sumologic_source_template.test", "schema_ref.0.type", "Mac"),
107104
resource.TestCheckResourceAttr("sumologic_source_template.test", "selector.0.tags.0.0.key", "updatedTag"),
108105
),
109106
},

0 commit comments

Comments
 (0)