opensearch-project / opensearch-cli

A full-featured command line interface (CLI) for OpenSearch.
https://opensearch.org/docs/latest/clients/cli/
Apache License 2.0
44 stars 24 forks source link

Implement curl patch command #46

Closed mikelorant closed 2 years ago

mikelorant commented 2 years ago

Description

Implement curl patch.

Issues Resolved

Allows for use of the patch method which is required for the OpenSearch security plugin.

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

codecov-commenter commented 2 years ago

Codecov Report

Merging #46 (94447d8) into main (5880590) will increase coverage by 0.13%. The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   67.26%   67.39%   +0.13%     
==========================================
  Files          31       32       +1     
  Lines        1848     1865      +17     
==========================================
+ Hits         1243     1257      +14     
- Misses        499      502       +3     
  Partials      106      106              
Flag Coverage Δ
opensearch-cli 67.39% <82.35%> (+0.13%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commands/curl_patch.go 81.25% <81.25%> (ø)
mapper/platform/platform.go 97.26% <100.00%> (+0.03%) :arrow_up:
VijayanB commented 2 years ago

Thanks for contribution. Can you also add an integration test here: https://github.com/opensearch-project/opensearch-cli/blob/main/it/platform/curl_test.go

mikelorant commented 2 years ago

Integration tests have been added. Not entirely happy with how I approached it but it does test the patch command successfully.

❯ go test -tags=integration ./it/...
ok      opensearch-cli/it   (cached)
ok      opensearch-cli/it/platform  4.034s

Verbose output also shows the following:

=== RUN   TestESGETSuite/TestCurlPatch
=== RUN   TestESGETSuite/TestCurlPatch/add_user_to_a_role_mapping
mikelorant commented 2 years ago

This passes tests on my environment. I have retested making sure to destroy the docker volume docker-compose down -v. Is there something else causing the tests to fail?

mikelorant commented 2 years ago

Confirmed there is something not working right, it is inconsistent so I will redo this PR. Unfortunately I have no experience with Go and this feels beyond my skills.

mikelorant commented 2 years ago

This is now working correctly with a much more functional integration test. Are you able to review this @VijayanB?

mikelorant commented 2 years ago

This still fails but I believe the reason is due to opensearch being tested does not have the security component enabled. I may be wrong, but I can see opensearch 2.0 is the target and is run with:

Run docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test
  docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test
  sleep 90
  shell: /usr/bin/bash -e {0}
  env:
    OPENSEARCH_VERSION: 2.0
    JAVA_HOME_11.0.15_x64: /opt/hostedtoolcache/jdk/11.0.15/x64
    JAVA_HOME: /opt/hostedtoolcache/jdk/11.0.15/x64
    JAVA_HOME_11_0_15_X64: /opt/hostedtoolcache/jdk/11.0.15/x64
09deeb62e393439425f3de624c799296bc0710002059c96edec30f9812e2e7ba
mikelorant commented 2 years ago

The issue is the current build process is broken with Opensearch 1.3.0 and newer.

❯ docker-compose down -v
Stopping test-node1 ... done
Removing test-node1 ... done
Removing network opensearch-cli_test-net
Removing volume opensearch-cli_test-data1

❯ export OPENSEARCH_VERSION=1.3.0

❯ docker-compose up -d
Creating network "opensearch-cli_test-net" with the default driver
Creating volume "opensearch-cli_test-data1" with default driver
Creating test-node1 ... done

❯ go test -tags=integration ./it/...
{"took":734,"errors":false,"items":[{"index":{"_index":"ecommerce","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}}]}
--- FAIL: TestADSuite (109.28s)
    --- FAIL: TestADSuite/TestDeleteDetectors (15.18s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
    --- FAIL: TestADSuite/TestDeleteDetectorsForce (15.25s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
    --- FAIL: TestADSuite/TestGetDetectors (15.21s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
    --- FAIL: TestADSuite/TestStartDetectors (15.21s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
    --- FAIL: TestADSuite/TestStopDetectors (15.28s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
    --- FAIL: TestADSuite/TestUpdateDetectors (15.22s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
    --- FAIL: TestADSuite/TestUpdateDetectorsForce (15.38s)
        ad_test.go:177: POST https://localhost:9200/_plugins/_anomaly_detection/detectors giving up after 5 attempt(s)
        ad_test.go:159: Detector ID cannot be empty
{"acknowledged":true,"shards_acknowledged":true,"index":"knn-sample-index"}
{"took":84,"errors":false,"items":[{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"2","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"3","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"4","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"5","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}}]}
FAIL
FAIL    opensearch-cli/it   109.968s
ok      opensearch-cli/it/platform  (cached)
FAIL

❯ docker-compose down -v
Stopping test-node1 ... done
Removing test-node1 ... done
Removing network opensearch-cli_test-net
Removing volume opensearch-cli_test-data1

❯ export OPENSEARCH_VERSION=1.2.0

❯ docker-compose up -d
Creating network "opensearch-cli_test-net" with the default driver
Creating volume "opensearch-cli_test-data1" with default driver
Creating test-node1 ... done

❯ go test -tags=integration ./it/...
ok      opensearch-cli/it   6.778s
ok      opensearch-cli/it/platform  (cached)
mikelorant commented 2 years ago

@VijayanB This something you could look into fixing? Seems like the build process needs a little repair.

mikelorant commented 2 years ago

Proving that my changes pass integration tests cleanly.

❯ go test -tags=integration ./it/... -v
=== RUN   TestADSuite
{"took":338,"errors":false,"items":[{"index":{"_index":"ecommerce","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}}]}
=== RUN   TestADSuite/TestCreateDetectors
=== RUN   TestADSuite/TestCreateDetectors/create_success
=== RUN   TestADSuite/TestDeleteDetectors
=== RUN   TestADSuite/TestDeleteDetectors/delete_stopped_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will delete above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestDeleteDetectorsForce
=== RUN   TestADSuite/TestDeleteDetectorsForce/delete_force_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will delete above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestGetDetectors
=== RUN   TestADSuite/TestGetDetectors/get_detector_success
=== RUN   TestADSuite/TestStartDetectors
=== RUN   TestADSuite/TestStartDetectors/start_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will start above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestStopDetectors
=== RUN   TestADSuite/TestStopDetectors/stop_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will stop above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestUpdateDetectors
=== RUN   TestADSuite/TestUpdateDetectors/update_detector_success
opensearch-cli will update detector: I5FE1YABKLSgjeah6UEW . Do you want to proceed? Y/N === RUN   TestADSuite/TestUpdateDetectorsForce
=== RUN   TestADSuite/TestUpdateDetectorsForce/update_detector_success
opensearch-cli will update detector: MpFE1YABKLSgjeah6UHV . Do you want to proceed? Y/N --- PASS: TestADSuite (3.84s)
    --- PASS: TestADSuite/TestCreateDetectors (0.22s)
        --- PASS: TestADSuite/TestCreateDetectors/create_success (0.21s)
    --- PASS: TestADSuite/TestDeleteDetectors (0.33s)
        --- PASS: TestADSuite/TestDeleteDetectors/delete_stopped_success (0.18s)
    --- PASS: TestADSuite/TestDeleteDetectorsForce (0.55s)
        --- PASS: TestADSuite/TestDeleteDetectorsForce/delete_force_success (0.41s)
    --- PASS: TestADSuite/TestGetDetectors (0.61s)
        --- PASS: TestADSuite/TestGetDetectors/get_detector_success (0.36s)
    --- PASS: TestADSuite/TestStartDetectors (0.54s)
        --- PASS: TestADSuite/TestStartDetectors/start_success (0.15s)
    --- PASS: TestADSuite/TestStopDetectors (0.52s)
        --- PASS: TestADSuite/TestStopDetectors/stop_success (0.30s)
    --- PASS: TestADSuite/TestUpdateDetectors (0.19s)
        --- PASS: TestADSuite/TestUpdateDetectors/update_detector_success (0.07s)
    --- PASS: TestADSuite/TestUpdateDetectorsForce (0.39s)
        --- PASS: TestADSuite/TestUpdateDetectorsForce/update_detector_success (0.23s)
=== RUN   TestKNNSuite
{"acknowledged":true,"shards_acknowledged":true,"index":"knn-sample-index"}
{"took":36,"errors":false,"items":[{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"2","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"3","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"4","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"5","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}}]}
=== RUN   TestKNNSuite/TestGetStatistics
=== RUN   TestKNNSuite/TestGetStatistics/test_get_full_stats
=== RUN   TestKNNSuite/TestGetStatistics/test_filtered_full_stats
=== RUN   TestKNNSuite/TestGetStatistics/test_filtered_nodes
=== RUN   TestKNNSuite/TestGetStatistics/test_filtered_only_stats
=== RUN   TestKNNSuite/TestWarmupIndices
=== RUN   TestKNNSuite/TestWarmupIndices/test_warmup_success
=== RUN   TestKNNSuite/TestWarmupIndices/test_warmup_failure
--- PASS: TestKNNSuite (0.47s)
    --- PASS: TestKNNSuite/TestGetStatistics (0.12s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_get_full_stats (0.02s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_filtered_full_stats (0.04s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_filtered_nodes (0.03s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_filtered_only_stats (0.03s)
    --- PASS: TestKNNSuite/TestWarmupIndices (0.02s)
        --- PASS: TestKNNSuite/TestWarmupIndices/test_warmup_success (0.01s)
        --- PASS: TestKNNSuite/TestWarmupIndices/test_warmup_failure (0.00s)
PASS
ok      opensearch-cli/it   4.326s
=== RUN   TestESGETSuite
{"took":380,"errors":false,"items":[{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"2","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"3","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"4","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"5","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}}]}
=== RUN   TestESGETSuite/TestCurlDelete
=== RUN   TestESGETSuite/TestCurlDelete/delete_index_document
=== RUN   TestESGETSuite/TestCurlDelete/delete_index
=== RUN   TestESGETSuite/TestCurlGet
=== RUN   TestESGETSuite/TestCurlGet/get_document_count_for_an_index
=== RUN   TestESGETSuite/TestCurlGet/health_status_of_a_cluster
=== RUN   TestESGETSuite/TestCurlGet/health_status_of_a_cluster_in_yaml
=== RUN   TestESGETSuite/TestCurlPatch
=== RUN   TestESGETSuite/TestCurlPatch/add_user_to_a_role_mapping
=== RUN   TestESGETSuite/TestCurlPost
=== RUN   TestESGETSuite/TestCurlPost/bulk_request
=== RUN   TestESGETSuite/TestCurlPost/bulk_request_compressed
=== RUN   TestESGETSuite/TestCurlPut
=== RUN   TestESGETSuite/TestCurlPut/index_a_document
--- PASS: TestESGETSuite (3.06s)
    --- PASS: TestESGETSuite/TestCurlDelete (1.02s)
        --- PASS: TestESGETSuite/TestCurlDelete/delete_index_document (0.51s)
        --- PASS: TestESGETSuite/TestCurlDelete/delete_index (0.51s)
    --- PASS: TestESGETSuite/TestCurlGet (0.05s)
        --- PASS: TestESGETSuite/TestCurlGet/get_document_count_for_an_index (0.01s)
        --- PASS: TestESGETSuite/TestCurlGet/health_status_of_a_cluster (0.01s)
        --- PASS: TestESGETSuite/TestCurlGet/health_status_of_a_cluster_in_yaml (0.02s)
    --- PASS: TestESGETSuite/TestCurlPatch (0.47s)
        --- PASS: TestESGETSuite/TestCurlPatch/add_user_to_a_role_mapping (0.47s)
    --- PASS: TestESGETSuite/TestCurlPost (0.53s)
        --- PASS: TestESGETSuite/TestCurlPost/bulk_request (0.41s)
        --- PASS: TestESGETSuite/TestCurlPost/bulk_request_compressed (0.12s)
    --- PASS: TestESGETSuite/TestCurlPut (0.49s)
        --- PASS: TestESGETSuite/TestCurlPut/index_a_document (0.49s)
PASS
ok      opensearch-cli/it/platform  3.068s
VijayanB commented 2 years ago

Proving that my changes pass integration tests cleanly.

❯ go test -tags=integration ./it/... -v
=== RUN   TestADSuite
{"took":338,"errors":false,"items":[{"index":{"_index":"ecommerce","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}}]}
=== RUN   TestADSuite/TestCreateDetectors
=== RUN   TestADSuite/TestCreateDetectors/create_success
=== RUN   TestADSuite/TestDeleteDetectors
=== RUN   TestADSuite/TestDeleteDetectors/delete_stopped_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will delete above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestDeleteDetectorsForce
=== RUN   TestADSuite/TestDeleteDetectorsForce/delete_force_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will delete above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestGetDetectors
=== RUN   TestADSuite/TestGetDetectors/get_detector_success
=== RUN   TestADSuite/TestStartDetectors
=== RUN   TestADSuite/TestStartDetectors/start_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will start above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestStopDetectors
=== RUN   TestADSuite/TestStopDetectors/stop_success
1 detectors matched by name setup-detector-it1
setup-detector-it1
opensearch-cli will stop above matched detector(s). Do you want to proceed? Y/N === RUN   TestADSuite/TestUpdateDetectors
=== RUN   TestADSuite/TestUpdateDetectors/update_detector_success
opensearch-cli will update detector: I5FE1YABKLSgjeah6UEW . Do you want to proceed? Y/N === RUN   TestADSuite/TestUpdateDetectorsForce
=== RUN   TestADSuite/TestUpdateDetectorsForce/update_detector_success
opensearch-cli will update detector: MpFE1YABKLSgjeah6UHV . Do you want to proceed? Y/N --- PASS: TestADSuite (3.84s)
    --- PASS: TestADSuite/TestCreateDetectors (0.22s)
        --- PASS: TestADSuite/TestCreateDetectors/create_success (0.21s)
    --- PASS: TestADSuite/TestDeleteDetectors (0.33s)
        --- PASS: TestADSuite/TestDeleteDetectors/delete_stopped_success (0.18s)
    --- PASS: TestADSuite/TestDeleteDetectorsForce (0.55s)
        --- PASS: TestADSuite/TestDeleteDetectorsForce/delete_force_success (0.41s)
    --- PASS: TestADSuite/TestGetDetectors (0.61s)
        --- PASS: TestADSuite/TestGetDetectors/get_detector_success (0.36s)
    --- PASS: TestADSuite/TestStartDetectors (0.54s)
        --- PASS: TestADSuite/TestStartDetectors/start_success (0.15s)
    --- PASS: TestADSuite/TestStopDetectors (0.52s)
        --- PASS: TestADSuite/TestStopDetectors/stop_success (0.30s)
    --- PASS: TestADSuite/TestUpdateDetectors (0.19s)
        --- PASS: TestADSuite/TestUpdateDetectors/update_detector_success (0.07s)
    --- PASS: TestADSuite/TestUpdateDetectorsForce (0.39s)
        --- PASS: TestADSuite/TestUpdateDetectorsForce/update_detector_success (0.23s)
=== RUN   TestKNNSuite
{"acknowledged":true,"shards_acknowledged":true,"index":"knn-sample-index"}
{"took":36,"errors":false,"items":[{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"2","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"3","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"4","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"index":{"_index":"knn-sample-index","_type":"_doc","_id":"5","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":1,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}}]}
=== RUN   TestKNNSuite/TestGetStatistics
=== RUN   TestKNNSuite/TestGetStatistics/test_get_full_stats
=== RUN   TestKNNSuite/TestGetStatistics/test_filtered_full_stats
=== RUN   TestKNNSuite/TestGetStatistics/test_filtered_nodes
=== RUN   TestKNNSuite/TestGetStatistics/test_filtered_only_stats
=== RUN   TestKNNSuite/TestWarmupIndices
=== RUN   TestKNNSuite/TestWarmupIndices/test_warmup_success
=== RUN   TestKNNSuite/TestWarmupIndices/test_warmup_failure
--- PASS: TestKNNSuite (0.47s)
    --- PASS: TestKNNSuite/TestGetStatistics (0.12s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_get_full_stats (0.02s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_filtered_full_stats (0.04s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_filtered_nodes (0.03s)
        --- PASS: TestKNNSuite/TestGetStatistics/test_filtered_only_stats (0.03s)
    --- PASS: TestKNNSuite/TestWarmupIndices (0.02s)
        --- PASS: TestKNNSuite/TestWarmupIndices/test_warmup_success (0.01s)
        --- PASS: TestKNNSuite/TestWarmupIndices/test_warmup_failure (0.00s)
PASS
ok    opensearch-cli/it   4.326s
=== RUN   TestESGETSuite
{"took":380,"errors":false,"items":[{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"1","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"2","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"3","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"4","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"index":{"_index":"bulk-user-request","_type":"_doc","_id":"5","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}}]}
=== RUN   TestESGETSuite/TestCurlDelete
=== RUN   TestESGETSuite/TestCurlDelete/delete_index_document
=== RUN   TestESGETSuite/TestCurlDelete/delete_index
=== RUN   TestESGETSuite/TestCurlGet
=== RUN   TestESGETSuite/TestCurlGet/get_document_count_for_an_index
=== RUN   TestESGETSuite/TestCurlGet/health_status_of_a_cluster
=== RUN   TestESGETSuite/TestCurlGet/health_status_of_a_cluster_in_yaml
=== RUN   TestESGETSuite/TestCurlPatch
=== RUN   TestESGETSuite/TestCurlPatch/add_user_to_a_role_mapping
=== RUN   TestESGETSuite/TestCurlPost
=== RUN   TestESGETSuite/TestCurlPost/bulk_request
=== RUN   TestESGETSuite/TestCurlPost/bulk_request_compressed
=== RUN   TestESGETSuite/TestCurlPut
=== RUN   TestESGETSuite/TestCurlPut/index_a_document
--- PASS: TestESGETSuite (3.06s)
    --- PASS: TestESGETSuite/TestCurlDelete (1.02s)
        --- PASS: TestESGETSuite/TestCurlDelete/delete_index_document (0.51s)
        --- PASS: TestESGETSuite/TestCurlDelete/delete_index (0.51s)
    --- PASS: TestESGETSuite/TestCurlGet (0.05s)
        --- PASS: TestESGETSuite/TestCurlGet/get_document_count_for_an_index (0.01s)
        --- PASS: TestESGETSuite/TestCurlGet/health_status_of_a_cluster (0.01s)
        --- PASS: TestESGETSuite/TestCurlGet/health_status_of_a_cluster_in_yaml (0.02s)
    --- PASS: TestESGETSuite/TestCurlPatch (0.47s)
        --- PASS: TestESGETSuite/TestCurlPatch/add_user_to_a_role_mapping (0.47s)
    --- PASS: TestESGETSuite/TestCurlPost (0.53s)
        --- PASS: TestESGETSuite/TestCurlPost/bulk_request (0.41s)
        --- PASS: TestESGETSuite/TestCurlPost/bulk_request_compressed (0.12s)
    --- PASS: TestESGETSuite/TestCurlPut (0.49s)
        --- PASS: TestESGETSuite/TestCurlPut/index_a_document (0.49s)
PASS
ok    opensearch-cli/it/platform  3.068s

@mikelorant Sorry for responding late. I will look into this PR this week. Are there any PATCH API requests from core other than plugins?

mikelorant commented 2 years ago

I do not know enough about the API to state if PATCH is used outside of plugins. But considering the security plugin is a key part of the implementation, it seems this should be added.

VijayanB commented 2 years ago

@mikelorant I updated CI to add plugin dependency before running tests. Can you rebase your change and update like here: https://github.com/VijayanB/opensearch-cli-1/commit/8bfec82703759c1667aaf353807efe8c69052e91

mikelorant commented 2 years ago

Seems to now just fail on the integration test for an unreleased opensearch. Is it possible this has not had the plugin added like the other versions?

VijayanB commented 2 years ago

Seems to now just fail on the integration test for an unreleased opensearch. Is it possible this has not had the plugin added like the other versions?

Yeah. Unreleased version will not have security plug-in. Can you add plug-in installation check like I mentioned in my previous comment? This should skip your test if cluster doesn’t have security plugin

mikelorant commented 2 years ago

Sorry I misunderstood your previous comment. I have made the change as requested.

mikelorant commented 2 years ago

Tests finally pass.

VijayanB commented 2 years ago

@jmazanec15 Can you take a look at this PR? Thanks