Skip to content

Commit

Permalink
add time.Sleep to cross-module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Nov 18, 2021
1 parent 2aed806 commit 8431c2d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions internal/langserver/handlers/code_lens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ variable "instances" {
type = number
}
`, submodUri.URI())})
// TODO remove once we support synchronous dependent tasks
// See https://github.com/hashicorp/terraform-ls/issues/719
time.Sleep(2 * time.Second)
ls.CallAndExpectResponse(t, &langserver.CallRequest{
Method: "textDocument/codeLens",
ReqParams: fmt.Sprintf(`{
Expand Down
6 changes: 2 additions & 4 deletions internal/langserver/handlers/complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,9 @@ output "test" {
}
}`, mainCfg, tmpDir.URI())})

// module manifest-dependent tasks are scheduled & executed
// asynchronously and we currently have no way of waiting
// for them to complete.
// TODO remove once we support synchronous dependent tasks
time.Sleep(1500 * time.Millisecond)
// See https://github.com/hashicorp/terraform-ls/issues/719
time.Sleep(2 * time.Second)

ls.CallAndExpectResponse(t, &langserver.CallRequest{
Method: "textDocument/completion",
Expand Down
4 changes: 4 additions & 0 deletions internal/langserver/handlers/go_to_ref_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"path/filepath"
"testing"
"time"

"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-ls/internal/langserver"
Expand Down Expand Up @@ -154,6 +155,9 @@ func TestDefinition_moduleInputToVariable(t *testing.T) {
"uri": "%s/main.tf"
}
}`, modUri.URI())})
// TODO remove once we support synchronous dependent tasks
// See https://github.com/hashicorp/terraform-ls/issues/719
time.Sleep(2 * time.Second)
ls.CallAndExpectResponse(t, &langserver.CallRequest{
Method: "textDocument/definition",
ReqParams: fmt.Sprintf(`{
Expand Down
4 changes: 4 additions & 0 deletions internal/langserver/handlers/references_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"path/filepath"
"testing"
"time"

"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-ls/internal/langserver"
Expand Down Expand Up @@ -178,6 +179,9 @@ variable "instances" {
"uri": "%s/main.tf"
}
}`, submodUri.URI())})
// TODO remove once we support synchronous dependent tasks
// See https://github.com/hashicorp/terraform-ls/issues/719
time.Sleep(2 * time.Second)
ls.CallAndExpectResponse(t, &langserver.CallRequest{
Method: "textDocument/references",
ReqParams: fmt.Sprintf(`{
Expand Down

0 comments on commit 8431c2d

Please sign in to comment.