sijie commented on a change in pull request #175: Issue 160: Introduce backward compatibility testing URL: https://github.com/apache/distributedlog/pull/175#discussion_r137102143
########## File path: tests/backward/src/main/java/org/apache/distributedlog/tests/backward/ReaderTest.java ########## @@ -0,0 +1,86 @@ +/* + * 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.distributedlog.tests.backward; + +import static com.google.common.base.Charsets.UTF_8; +import static com.google.common.base.Preconditions.checkArgument; + +import java.net.URI; +import org.apache.distributedlog.DistributedLogConfiguration; +import org.apache.distributedlog.LogRecord; +import org.apache.distributedlog.api.AsyncLogReader; +import org.apache.distributedlog.api.DistributedLogManager; +import org.apache.distributedlog.api.namespace.Namespace; +import org.apache.distributedlog.api.namespace.NamespaceBuilder; +import org.apache.distributedlog.common.concurrent.FutureUtils; +import org.apache.distributedlog.util.Utils; + +/** + * A test program to read records. + */ +public class ReaderTest { Review comment: BookKeeper does this in unit tests. However it is a bit painful there, because for each version, we have to create a shaded dependencies, and the unit tests have to be written using the shaded dependencies. I am exploring a different approach here is to use docker image for doing backward-compat tests. If we have a standard tool for writing records and reading records, and we have docker image for different versions, we can easily have a script to test backward compatibility. we don't need to maintain different versions in the project. suppose we have bookie docker image for version x, x+1; client image (WriterTest and ReaderTest) for version x and x+1. we can then: - start bookies using bookie image x - start a writer using tests image x to produce a stream with N records - verify reads: start a read using tests image x to read the stream - verify reads: start a read using tests image x+1 to read the stream - test upgrade bookies - stop the bookies - start the bookies using image x+1 - verify write and reads. so ideally we should only keep one version in the master code (the reason I added 0.4 in the master code is because we don't have any docker image or testing code before). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
