Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/provider/query_specification_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (d *querySpecDataSource) Schema(_ context.Context, _ datasource.SchemaReque
},
"granularity": schema.Int64Attribute{
Description: "The time resolution of the query's graph, in seconds. " +
"Valid values must be in between the query's time range /10 at maximum, and /1000 at minimum.",
"Valid values must be in between the query's time range at maximum, and /1000 at minimum.",
Optional: true,
Validators: []validator.Int64{int64validator.AtLeast(0)},
},
Expand Down Expand Up @@ -490,11 +490,11 @@ func (d *querySpecDataSource) Read(ctx context.Context, req datasource.ReadReque
)
}
if querySpec.TimeRange != nil && querySpec.Granularity != nil {
if *querySpec.Granularity > (*querySpec.TimeRange / 10) {
if *querySpec.Granularity > *querySpec.TimeRange {
resp.Diagnostics.AddAttributeError(
path.Root("granularity"),
"invalid granularity",
"granularity can not be greater than time_range/10",
"granularity can not be greater than time_range",
)
}
if *querySpec.Granularity != 0 && *querySpec.Granularity < (*querySpec.TimeRange/1000) {
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/query_specification_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ data "honeycombio_query_specification" "test" {
Config: `
data "honeycombio_query_specification" "test" {
time_range = 120
granularity = 13
granularity = 121
}`,
PlanOnly: true,
ExpectError: regexp.MustCompile("granularity can not be greater than time_range/10"),
ExpectError: regexp.MustCompile("granularity can not be greater than time_range"),
},
{
Config: `
Expand Down
Loading