Skip to content
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

Add ITVersion for helping management the versions in IT #12895

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions oap-server/server-library/library-integration-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>server-library</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>library-integration-test</artifactId>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.skywalking.oap.server.library.it;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import java.util.stream.Collectors;

/**
* ITVersions is a utility class to read the version information from the environment file.
*/
public class ITVersions {

static Map<String, String> ENV = readingEnv("test", "e2e-v2", "script", "env");

// Get the version from the environment file.
public static String get(String key) {
return ENV.get(key);
}

private static Map<String, String> readingEnv(String... envFile) {
// Find the project root directory and get the environment file path.
Path envFilePath = getProjectRootDir();
for (String subPath : envFile) {
envFilePath = envFilePath.resolve(subPath);
}

try {
return Files.readAllLines(envFilePath).stream()
.filter(l -> !l.startsWith("#"))
.map(l -> l.split("=", 2))
.filter(l -> l.length == 2)
.collect(Collectors.toMap(l -> l[0], l -> l[1], (older, newer) -> newer));
} catch (IOException e) {
throw new IllegalStateException("Reading environment file error, path: " + envFile, e);
}
}

// Get the project root directory which should contain the mvnw file.
private static Path getProjectRootDir() {
Path path = Paths.get(System.getProperty("user.dir"));
while (!Files.exists(path.resolve("mvnw"))) {
path = path.getParent();
}
return path;
}

}
1 change: 1 addition & 0 deletions oap-server/server-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
<module>library-datacarrier-queue</module>
<module>library-kubernetes-support</module>
<module>library-async-profiler-jfr-parser</module>
<module>library-integration-test</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@
<groupId>org.apache.skywalking</groupId>
<artifactId>banyandb-java-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>library-integration-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity;
import org.apache.skywalking.oap.server.core.storage.type.Convert2Storage;
import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
import org.apache.skywalking.oap.server.library.it.ITVersions;
import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.apache.skywalking.oap.server.library.module.ModuleProviderHolder;
import org.apache.skywalking.oap.server.library.module.ModuleServiceHolder;
Expand Down Expand Up @@ -77,7 +78,7 @@
public class BanyanDBIT {
private static final String REGISTRY = "ghcr.io";
private static final String IMAGE_NAME = "apache/skywalking-banyandb";
private static final String TAG = "6e99ab7e8fed451d24e4d6041ec4c3db7c44f237";
private static final String TAG = ITVersions.get("SW_BANYANDB_COMMIT");

private static final String IMAGE = REGISTRY + "/" + IMAGE_NAME + ":" + TAG;
private static MockedStatic<DefaultScopeDefine> DEFAULT_SCOPE_DEFINE_MOCKED_STATIC;
Expand Down
Loading