-
Notifications
You must be signed in to change notification settings - Fork 74
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
Fix error when creating a view with invalid mappings or settings #4365
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclCheck | |
import ch.epfl.bluebrain.nexus.delta.sdk.deletion.ProjectDeletionTask | ||
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaSchemeDirectives | ||
import ch.epfl.bluebrain.nexus.delta.sdk.fusion.FusionConfig | ||
import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClient | ||
import ch.epfl.bluebrain.nexus.delta.sdk.http.{HttpClient, HttpClientConfig} | ||
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities | ||
import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.ServiceAccount | ||
import ch.epfl.bluebrain.nexus.delta.sdk.model._ | ||
|
@@ -53,8 +53,8 @@ class ElasticSearchPluginModule(priority: Int) extends ModuleDef { | |
make[ElasticSearchViewsConfig].from { ElasticSearchViewsConfig.load(_) } | ||
|
||
make[HttpClient].named("elasticsearch-client").from { | ||
(cfg: ElasticSearchViewsConfig, as: ActorSystem[Nothing], sc: Scheduler) => | ||
HttpClient()(cfg.client, as.classicSystem, sc) | ||
val httpConfig = HttpClientConfig.noRetry(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The retry strategy was responsible for timeouts. |
||
(as: ActorSystem[Nothing], sc: Scheduler) => HttpClient()(httpConfig, as.classicSystem, sc) | ||
} | ||
|
||
make[ElasticSearchClient].from { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,20 @@ class ElasticSearchViewsSpec extends BaseSpec with EitherValuable with CirceEq { | |
} | ||
} | ||
|
||
"fail to create a view with an invalid mapping" in { | ||
val invalidMapping = | ||
json"""{"mapping": "fail"}""" | ||
val payload = json"""{ "@type": "ElasticSearchView", "mapping": $invalidMapping }""" | ||
deltaClient.put[Json](s"/views/$fullId/invalid", payload, ScoobyDoo) { expectBadRequest } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
"fail to create a view with invalid settings" in { | ||
val invalidSettings = | ||
json"""{"analysis": "fail"}""" | ||
val payload = json"""{ "@type": "ElasticSearchView", "mapping": { }, "settings": $invalidSettings }""" | ||
deltaClient.put[Json](s"/views/$fullId/invalid", payload, ScoobyDoo) { expectBadRequest } | ||
} | ||
olivergrabinski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
"create people view in project 2" in { | ||
deltaClient.put[Json]( | ||
s"/views/$fullId2/test-resource:people", | ||
|
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.
Unused