opensearch-project / alerting

📟 Get notified when your data meets certain conditions by setting up monitors, alerts, and notifications
https://opensearch.org/docs/latest/monitoring-plugins/alerting/index/
Apache License 2.0
62 stars 102 forks source link

Add additional backend roles test cases #300

Open adityaj1107 opened 2 years ago

adityaj1107 commented 2 years ago

Describe the solution you'd like We can add additional backend role test cases for the alerting plugin to test fine grained access control via security plugin. We can find more information on backend roles here:

Reference: https://github.com/opensearch-project/alerting/issues/219

lezzago commented 2 years ago

Add trimIndent to the entities Ref to the file this started from: https://github.com/opensearch-project/alerting/pull/303/files#r801173359

adityaj1107 commented 2 years ago

Add the test cases for the no_access role.

Ref:

adityaj1107 commented 2 years ago

Additional References:

adityaj1107 commented 2 years ago

Future Improvements:

cc: @getsaurabh02

qreshi commented 2 years ago

Security tests are failing due to a recent change to the assertions and the recommendation is to revert the assertion check back (example run: https://github.com/opensearch-project/alerting/runs/5401010692?check_suite_focus=true)

Current failing assertion:

        } catch (e: AssertionError) {
            assertEquals("Unexpected status", "Expected 403 FORBIDDEN response", e.message)
        }

Old passing assertion:

        } catch (e: ResponseException) {
            assertEquals("Unexpected status", RestStatus.FORBIDDEN, e.response.restStatus())
        }

The reason this wasn't caught when the changes themselves were introduced was because the OpenSearch 1.3.0 snapshot distribution that is used to run these tests was failing for the last couple weeks until recently due to some security plugin bug.

lezzago commented 2 years ago

It seems like the integ tests are flaky

lezzago commented 2 years ago

It seems like the integ tests are flaky

This could be due to the security docker image