gerlowskija commented on code in PR #4203: URL: https://github.com/apache/solr/pull/4203#discussion_r3210811670
########## solr/packaging/test/test_schema_designer.bats: ########## @@ -0,0 +1,108 @@ +#!/usr/bin/env bats + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# System-level coverage of the schema-designer HTTP surface only. +# Per-endpoint behavior is tested in TestSchemaDesigner.java. + +load bats_helper + +DESIGNER_CONFIGSET="bats_books" + +setup_file() { + common_clean_setup + solr start + solr assert --started http://localhost:${SOLR_PORT} --timeout 60000 +} + +teardown_file() { + common_setup + solr stop --all +} + +setup() { + common_setup +} + +teardown() { + save_home_on_failure + curl -s -X DELETE "http://localhost:${SOLR_PORT}/api/schema-designer/${DESIGNER_CONFIGSET}" > /dev/null || true +} + +@test "list schema-designer configs returns JSON with configSets key" { + run curl -s "http://localhost:${SOLR_PORT}/api/schema-designer/configs" + assert_output --partial '"configSets"' + refute_output --partial '"status":400' + refute_output --partial '"status":500' +} + +@test "schema-designer end-to-end flow over HTTP" { + run curl -s -X POST \ + "http://localhost:${SOLR_PORT}/api/schema-designer/${DESIGNER_CONFIGSET}/prep?copyFrom=_default" + assert_output --partial '"configSet"' + refute_output --partial '"status":400' + refute_output --partial '"status":500' + + run curl -s -X POST \ + -H "Content-Type: application/json" \ + --data-binary "@${SOLR_TIP}/example/exampledocs/books.json" \ + "http://localhost:${SOLR_PORT}/api/schema-designer/${DESIGNER_CONFIGSET}/analyze" + assert_output --partial '"configSet"' + refute_output --partial '"status":400' + refute_output --partial '"status":500' + + run curl -s \ + "http://localhost:${SOLR_PORT}/api/schema-designer/${DESIGNER_CONFIGSET}/query?q=*:*" + assert_output --partial '"numFound"' + refute_output --partial '"status":400' + refute_output --partial '"status":500' + + run curl -s -o /dev/null -w "%{http_code}" \ + -X DELETE "http://localhost:${SOLR_PORT}/api/schema-designer/${DESIGNER_CONFIGSET}" + assert_output "200" +} + +@test "download schema-designer configSet as zip" { + curl -s -X POST \ + "http://localhost:${SOLR_PORT}/api/schema-designer/${DESIGNER_CONFIGSET}/prep?copyFrom=_default" \ + > /dev/null + + local zip_file="${BATS_TEST_TMPDIR}/${DESIGNER_CONFIGSET}.zip" + local mutable_id="._designer_${DESIGNER_CONFIGSET}" + + local http_code + http_code=$(curl -s -o "${zip_file}" -w "%{http_code}" \ + "http://localhost:${SOLR_PORT}/api/configsets/${mutable_id}/files?displayName=${DESIGNER_CONFIGSET}") Review Comment: [-1] `displayName`? I don't see that as a query param on any of these schema-designer APIs, am I missing something? (Check for other occurrences in this file.) ########## changelog/unreleased/SOLR-18152-add-configset-download-zip-to-solrj-fix-schema-designer-bug.yml: ########## @@ -0,0 +1,8 @@ +# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc +title: Fixed a bug in the analyze sample documents feature of Schema Designer that prevented the designer from working. Review Comment: [0] IMO this changelog entry isn't that informative. "Fixed a bug in the Schema Designer" doesn't really tell a user what the bug was, or whether it was one they were likely to run into. Consider wording it like the following: > Schema Designer sample-doc analysis now works correctly when <whatever criteria triggered the previous bug> [0] In addition to the bug fix, this PR adds a ton of API coverage to SolrJ. Idk how many people care about our schema-designer APIs as they're so UI focused. But this is at least theoretically valuable to people... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
