File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference
src/internalClusterTest/java/org/elasticsearch/xpack/inference/integration Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 2020import org .elasticsearch .test .cluster .ElasticsearchCluster ;
2121import org .elasticsearch .test .cluster .local .distribution .DistributionType ;
2222import org .elasticsearch .xpack .core .inference .action .PutCCMConfigurationAction ;
23+ import org .elasticsearch .xpack .inference .services .elastic .ccm .CCMFeatureFlag ;
2324import org .junit .After ;
25+ import org .junit .BeforeClass ;
2426import org .junit .ClassRule ;
2527
2628import java .io .IOException ;
@@ -52,10 +54,19 @@ protected Settings restClientSettings() {
5254 return Settings .builder ().put (ThreadContext .PREFIX + ".Authorization" , token ).build ();
5355 }
5456
57+ @ BeforeClass
58+ public static void classSetup () {
59+ assumeTrue ("CCM is behind a feature flag and snapshot only right now" , CCMFeatureFlag .FEATURE_FLAG .isEnabled ());
60+ }
61+
5562 @ After
56- public void cleanup () throws IOException {
57- // Disable CCM after each test to ensure a clean state
58- deleteCCMConfiguration ();
63+ public void cleanup () {
64+ try {
65+ // Disable CCM after each test to ensure a clean state
66+ client ().performRequest (new Request (DELETE_METHOD , INFERENCE_CCM_PATH ));
67+ } catch (Exception e ) {
68+ // ignore failures
69+ }
5970 }
6071
6172 public void testEnablesCCM_Succeeds () throws IOException {
Original file line number Diff line number Diff line change 1919import org .elasticsearch .xpack .inference .registry .ModelRegistry ;
2020import org .elasticsearch .xpack .inference .services .elastic .ElasticInferenceServiceSettings ;
2121import org .elasticsearch .xpack .inference .services .elastic .authorization .AuthorizationTaskExecutor ;
22+ import org .elasticsearch .xpack .inference .services .elastic .ccm .CCMFeatureFlag ;
2223import org .elasticsearch .xpack .inference .services .elastic .ccm .CCMModel ;
2324import org .elasticsearch .xpack .inference .services .elastic .ccm .CCMService ;
2425import org .elasticsearch .xpack .inference .services .elastic .ccm .CCMSettings ;
@@ -73,6 +74,8 @@ public void delete(ActionListener<Void> listener) {
7374
7475 @ BeforeClass
7576 public static void initClass () throws IOException {
77+ assumeTrue ("CCM is behind a feature flag and snapshot only right now" , CCMFeatureFlag .FEATURE_FLAG .isEnabled ());
78+
7679 webServer .start ();
7780 gatewayUrl = getUrl (webServer );
7881 }
You can’t perform that action at this time.
0 commit comments