Skip to content

Commit

Permalink
Merge pull request #31 from artipie/30
Browse files Browse the repository at this point in the history
Test with aarch64 rpm
  • Loading branch information
g4s8 authored Mar 11, 2020
2 parents 58407fa + a293fa0 commit 516e1a8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/test/java/com/artipie/rpm/RpmTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import org.cactoos.Scalar;
import org.cactoos.experimental.Threads;
Expand All @@ -48,8 +49,14 @@
* Test case for {@link Rpm}.
*
* @since 0.0.3
* @todo #30:30min Refactor this test. Convert it to Junit5 and use `TempDir`
* extension, refactor same logic for extracting rpm file from resources,
* get rid of multi-threading in matcher, simplify the test,
* test only one thing in each unit test (split test to multiple if needed).
* Also, remove supressed PMD warning.
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public final class RpmTest {

/**
Expand All @@ -59,6 +66,40 @@ public final class RpmTest {
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
public TemporaryFolder folder = new TemporaryFolder();

@Test
public void updateAarchRpm() throws Exception {
final Path home = Paths.get(
System.getProperty("testDirectory", "target/tests")
);
FileUtils.deleteDirectory(home.toFile());
home.toFile().mkdirs();
final Storage storage = new FileStorage(home);
final Path bin = this.folder.newFile("x.rpm").toPath();
final String key = "aom-1.0.0-8.20190810git9666276.el8.aarch64.rpm";
Files.copy(
RpmITCase.class.getResourceAsStream(
String.format("/%s", key)
),
bin,
StandardCopyOption.REPLACE_EXISTING
);
storage.save(new Key.From(key), new RxFile(bin).flow()).get();
new Rpm(storage).update(key).blockingAwait();
MatcherAssert.assertThat(
storage.list(new Key.From("repodata"))
.get().stream().map(Key::string).collect(Collectors.toList()),
Matchers.containsInAnyOrder(
"repodata/repomd.xml",
"repodata/filelists.xml",
"repodata/other.xml",
"repodata/primary.xml",
"repodata/filelists.xml.gz",
"repodata/other.xml.gz",
"repodata/primary.xml.gz"
)
);
}

/**
* Rpm storage works, in many threads.
*
Expand Down
Binary file not shown.

1 comment on commit 516e1a8

@0pdd
Copy link

@0pdd 0pdd commented on 516e1a8 Mar 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 30-6f533735 discovered in src/test/java/com/artipie/rpm/RpmTest.java and submitted as #32. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.