ingest_simulate_pipeline_test.go 745 B

1234567891011121314151617181920212223242526272829303132333435
  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 "testing"
  6. func TestIngestSimulatePipelineURL(t *testing.T) {
  7. client := setupTestClientAndCreateIndex(t)
  8. tests := []struct {
  9. Id string
  10. Expected string
  11. }{
  12. {
  13. "",
  14. "/_ingest/pipeline/_simulate",
  15. },
  16. {
  17. "my-pipeline-id",
  18. "/_ingest/pipeline/my-pipeline-id/_simulate",
  19. },
  20. }
  21. for _, test := range tests {
  22. path, _, err := client.IngestSimulatePipeline().Id(test.Id).buildURL()
  23. if err != nil {
  24. t.Fatal(err)
  25. }
  26. if path != test.Expected {
  27. t.Errorf("expected %q; got: %q", test.Expected, path)
  28. }
  29. }
  30. }