Skip to content

Commit

Permalink
chore: move pd tests to hg-pd-test
Browse files Browse the repository at this point in the history
  • Loading branch information
VGalaxies committed Oct 12, 2023
1 parent d48d55e commit c5e0c3f
Show file tree
Hide file tree
Showing 38 changed files with 424 additions and 736 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/pd-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ jobs:
run: |
$TRAVIS_DIR/install-backend.sh $BACKEND
- name: Run pd test
run: |
mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test
- name: Run store test
run: |
mvn test -pl hg-store-test/hg-store-client -am -P store-client-test
- name: Run unit test
run: |
$TRAVIS_DIR/run-unit-test.sh $BACKEND
Expand Down

This file was deleted.

This file was deleted.

139 changes: 0 additions & 139 deletions hugegraph-pd/hg-pd-core/src/test/resources/log4j2.xml

This file was deleted.

11 changes: 5 additions & 6 deletions hugegraph-pd/hg-pd-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<version>2.20</version>
<executions>
<execution>
<id>client-test</id>
<id>pd-client-test</id>
<configuration>
<testSourceDirectory>${basedir}/src/main/java/
</testSourceDirectory>
Expand All @@ -256,7 +256,7 @@
</configuration>
</execution>
<execution>
<id>core-test</id>
<id>pd-core-test</id>
<configuration>
<testSourceDirectory>${basedir}/src/main/java/
</testSourceDirectory>
Expand All @@ -268,7 +268,7 @@
</configuration>
</execution>
<execution>
<id>cli-tools-test</id>
<id>pd-cli-tools-test</id>
<configuration>
<testSourceDirectory>${basedir}/src/main/java/
</testSourceDirectory>
Expand All @@ -280,7 +280,7 @@
</configuration>
</execution>
<execution>
<id>common-test</id>
<id>pd-common-test</id>
<configuration>
<testSourceDirectory>${basedir}/src/main/java/
</testSourceDirectory>
Expand All @@ -292,7 +292,7 @@
</configuration>
</execution>
<execution>
<id>service-test</id>
<id>pd-service-test</id>
<configuration>
<testSourceDirectory>${basedir}/src/main/java/
</testSourceDirectory>
Expand All @@ -303,7 +303,6 @@
</includes>
</configuration>
</execution>

</executions>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,37 @@

package org.apache.hugegraph.pd.common;

import org.apache.hugegraph.pd.common.PartitionUtils;
import java.nio.charset.StandardCharsets;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;

import lombok.extern.slf4j.Slf4j;


@Slf4j
public class PartitionUtilsTest extends BaseCommonTest {

@Test
public void testCalcHashcode() {
byte[] key = new byte[5];
long code = PartitionUtils.calcHashcode(key);
Assert.assertEquals(code, 31912L);
}
}

// @Test
public void testHashCode() {
int partCount = 10;
int partSize = PartitionUtils.MAX_VALUE / partCount + 1;
int[] counter = new int[partCount];
for (int i = 0; i < 10000; i++) {
String s = String.format("BATCH-GET-UNIT-%02d", i);
int c = PartitionUtils.calcHashcode(s.getBytes(StandardCharsets.UTF_8));

counter[c / partSize]++;

}

for (int i = 0; i < counter.length; i++) {
System.out.println(i + " " + counter[i]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* under the License.
*/

package live;
package org.apache.hugegraph.pd.live;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* under the License.
*/

package live;
package org.apache.hugegraph.pd.live;

import java.io.File;
import java.io.IOException;
Expand Down
Loading

0 comments on commit c5e0c3f

Please sign in to comment.