janhoy commented on code in PR #5323: URL: https://github.com/apache/solr/pull/5323#discussion_r4551207155
########## solr/packaging/src/test/org/apache/solr/shell/CompressionTest.java: ########## @@ -0,0 +1,88 @@ +/* + * 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. + */ + +package org.apache.solr.shell; + +import java.util.Map; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Port of {@code test_compression.bats}. + * + * <p>Kept close to the original, including the order of the tests and the text each asserts on. + * Where it differs: + * + * <ul> + * <li>{@code curl -D -} becomes {@link #http}, so the header dump the original asserted on as + * part of the body is asserted on as the response headers instead. + * <li>{@code curl --compressed} becomes a request that asks for {@code Accept-Encoding}; the + * harness decompresses the body the same way curl does. + * <li>The original's {@code solr start -e films} is deliberately not used: on Windows {@code + * RunExampleTool#startSolr} drops every {@code SOLR_*} variable from the spawned node's + * environment, so the node cannot be discovered or stopped and the suite would be bash-only + * for a reason unrelated to what it tests (see {@code SnapshotsTest}). These tests only need + * a collection with enough documents that a response exceeds Jetty's 2048-byte {@code + * minGzipSize}, so a plain start, {@code solr create} and {@code solr post} of the example + * docs stand in. + * <li>The first two tests also assert the status, and the second and third that the negotiated + * encoding really was gzip — the claim their names make. + * </ul> + */ +public class CompressionTest extends SolrShellTestCase { + + private static final String COLLECTION = "compression_docs"; Review Comment: That's a fair point. But as we have 3 usages of the same string constant in the test, I don't like repeating them inline, taste I guess. An aternative would be to set it as env, perhaps more readable? ```java env("COLLECTION", "compression_docs") // line 55 run("solr create -c {{COLLECTION}} -d _default"); ``` -- 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]
