tasks_get_task_test.go 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2012-present Oliver Eilhard. All rights reserved.
  2. // Use of this source code is governed by a MIT-license.
  3. // See http://olivere.mit-license.org/license.txt for details.
  4. package elastic
  5. import (
  6. "testing"
  7. )
  8. func TestTasksGetTaskBuildURL(t *testing.T) {
  9. client := setupTestClient(t)
  10. // Get specific task
  11. got, _, err := client.TasksGetTask().TaskId("123").buildURL()
  12. if err != nil {
  13. t.Fatal(err)
  14. }
  15. want := "/_tasks/123"
  16. if got != want {
  17. t.Errorf("want %q; got %q", want, got)
  18. }
  19. }
  20. /*
  21. func TestTasksGetTask(t *testing.T) {
  22. client := setupTestClientAndCreateIndexAndAddDocs(t)
  23. esversion, err := client.ElasticsearchVersion(DefaultURL)
  24. if err != nil {
  25. t.Fatal(err)
  26. }
  27. if esversion < "2.3.0" {
  28. t.Skipf("Elasticsearch %v does not support Tasks Management API yet", esversion)
  29. }
  30. res, err := client.TasksGetTask().TaskId("123").Do(context.TODO())
  31. if err != nil {
  32. t.Fatal(err)
  33. }
  34. if res == nil {
  35. t.Fatal("response is nil")
  36. }
  37. }
  38. */