-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature/multi_tenancy] Tenant-aware integration tests for Connector, Model, Agent, Model Groups #2818
base: feature/multi_tenancy
Are you sure you want to change the base?
[Feature/multi_tenancy] Tenant-aware integration tests for Connector, Model, Agent, Model Groups #2818
Conversation
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
31995ee
to
b48efcc
Compare
Signed-off-by: Daniel Widdis <widdis@gmail.com>
b48efcc
to
cca0c6c
Compare
@@ -184,10 +187,23 @@ integTest { | |||
systemProperty "user", System.getProperty("user") | |||
systemProperty "password", System.getProperty("password") | |||
|
|||
// Only tenant aware test if set | |||
if (System.getProperty("tests.rest.tenantaware") != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we need to check true
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, you're looking at this PR! :)
Yes, we do. Most of the build.gradle
right now is a work in progress; we need to figure out a way to test on all the different remote stores but they also require a lot more setup (docker, ddb, etc.). Still need to do some cleanup at the end of all the tests as well (since the "wipe all indices" doesn't work remotely).
@@ -19,18 +19,14 @@ | |||
|
|||
import static org.opensearch.sdk.SdkClientUtils.unwrapAndConvertToException; | |||
|
|||
public class SdkClient implements SettingsChangeListener { | |||
public class SdkClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to change this?
I understand if we make the settings static, there's no need for the listener. But even if we keep the settings static this piece of code shouldn't break the functionality.
IMO, it's even a two way door, like if we want to make the settings dynamic, corresponding listener solution is already in place. On top of that we haven't finalized the nature of this settings yet.
@@ -677,4 +674,26 @@ public void testSearchDataObject_NullTenantId() throws IOException { | |||
assertEquals(OpenSearchStatusException.class, cause.getClass()); | |||
assertEquals("Tenant ID is required when multitenancy is enabled.", cause.getMessage()); | |||
} | |||
|
|||
public void testSearchDataObject_NullTenantNoMultitenancy() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add @Test
public static final Setting<Boolean> ML_COMMONS_MULTI_TENANCY_ENABLED = Setting | ||
.boolSetting("plugins.ml_commons.multi_tenancy_enabled", false, Setting.Property.NodeScope, Setting.Property.Dynamic); | ||
.boolSetting("plugins.ml_commons.multi_tenancy_enabled", false, Setting.Property.NodeScope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we need to make this settings static, do we need to do this now?
Usually dynamic was helpful for manual testing :D
|
||
public class RestMLConnectorTenantAwareIT extends MLCommonsTenantAwareRestTestCase { | ||
|
||
public void testConnectorCRUD() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add @Test
Description
Tests the entire Create-Get-Update-Search-Delete cycle with multi-tenancy (both enabled and not).
Validates expected results when tenant aware and when not (current status quo).
Looking for review on the approach before replicating to models and agents and other tenant-aware updates, although I won't wait before starting that work. If you want a simpler review, get started now. :)
To execute just these tests:
or
Because the classes end in
IT
, the "false" version executes with normal integ tests as well, a separate test needs to be done for thetrue
case.Check List
--signoff
.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.