Skip to content

Commit

Permalink
Merge pull request #99 from prometheus-community/test
Browse files Browse the repository at this point in the history
Thoroughly  test cache package
  • Loading branch information
slrtbtfs authored Feb 18, 2020
2 parents c6daa80 + 0d6717b commit 03d3899
Show file tree
Hide file tree
Showing 14 changed files with 565 additions and 362 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.3.0
github.com/prometheus/common v0.9.1
github.com/prometheus/prometheus v1.8.2-0.20200120155032-a6776221848b
github.com/prometheus/prometheus v1.8.2-0.20200213233353-b90be6f32a33
github.com/rakyll/statik v0.1.7-0.20191104211043-6b2f3ee522b6
github.com/spaolacci/murmur3 v1.1.0 // indirect
golang.org/x/mod v0.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa
github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/prometheus v0.0.0-20180315085919-58e2a31db8de/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s=
github.com/prometheus/prometheus v1.8.2-0.20200120155032-a6776221848b h1:RIICDDarqlBbSRvTgomV+8obUlIj/DFxFgFjDqDLnn0=
github.com/prometheus/prometheus v1.8.2-0.20200120155032-a6776221848b/go.mod h1:fkIPPkuZnkXyopYHmXPxf9rgiPkVgZCN8w9o8+UgBlY=
github.com/prometheus/prometheus v1.8.2-0.20200213233353-b90be6f32a33 h1:HBYrMJj5iosUjUkAK9L5GO+5eEQXbcrzdjkqY9HV5W4=
github.com/prometheus/prometheus v1.8.2-0.20200213233353-b90be6f32a33/go.mod h1:fkIPPkuZnkXyopYHmXPxf9rgiPkVgZCN8w9o8+UgBlY=
github.com/rakyll/statik v0.1.7-0.20191104211043-6b2f3ee522b6 h1:aTZBZ+7KwHnr9TPzd4l4PGvUJckC0Vw30gxXBxMGhyo=
github.com/rakyll/statik v0.1.7-0.20191104211043-6b2f3ee522b6/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
Expand Down
73 changes: 0 additions & 73 deletions langserver/ast_test.go

This file was deleted.

7 changes: 3 additions & 4 deletions langserver/ast.go → langserver/cache/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package langserver
package cache

import (
"go/token"

"github.com/prometheus-community/promql-langserver/langserver/cache"
"github.com/prometheus/prometheus/promql"
)

func getSmallestSurroundingNode(query *cache.CompiledQuery, tokenPos token.Pos) promql.Node {
func getSmallestSurroundingNode(query *CompiledQuery, tokenPos token.Pos) promql.Node {
ast := query.Ast

pos := promql.Pos(tokenPos - query.Pos)

if pos < ast.PositionRange().Start || pos > ast.PositionRange().End {
if ast == nil || pos < ast.PositionRange().Start || pos > ast.PositionRange().End {
return nil
}

Expand Down
Loading

0 comments on commit 03d3899

Please sign in to comment.