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

Fix FileInStreamIntegrationTest #18178

Merged
merged 11 commits into from
Oct 10, 2023

Conversation

voddle
Copy link
Contributor

@voddle voddle commented Sep 20, 2023

Fix FileInStreamIntegrationTest, removed unnecessary test cases

@ssz1997
Copy link
Contributor

ssz1997 commented Sep 21, 2023

Is this test broken at this point?

@voddle
Copy link
Contributor Author

voddle commented Sep 21, 2023

Is this test broken at this point?

yes

@Test(timeout = 10000)
@LocalAlluxioClusterResource.Config(
confParams = {PropertyKey.Name.WORKER_BLOCK_HEARTBEAT_INTERVAL_MS, "2000"})
public void asyncCacheFirstBlock() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

async cache feature has been deprecated and removed

@Test(timeout = 10000)
@LocalAlluxioClusterResource.Config(
confParams = {PropertyKey.Name.WORKER_BLOCK_HEARTBEAT_INTERVAL_MS, "2000"})
public void asyncCacheAfterSeek() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

async cache feature has been deprecated and removed

}

@Test(timeout = 10000)
public void asyncCacheFirstBlockPRead() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

async cache feature has been deprecated and removed

Copy link
Contributor

Choose a reason for hiding this comment

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

let's leave this comment open here so if anyone traces the code to this PR they will know what's going on

}

@Test
public void syncCacheFirstBlock() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

@dbw9580 do you know if this test should still be relevant? I figure it's the getFileBlockInfos() is somehow a deprecated API? But we should still fix this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

it basically requires the first portion of the file is cached when the length of the read is larger than the size of a block. The requirement still applies to page store, but it may not be able to report block level information. I suggest to use the cache usage API on worker's cache manager directly to verify the size of the file being cached. something like

CacheManager cm = worker.getCacheManager(); // <- this method may not exist yet
long usedBytes = cm.getUsage()
    .partitionedBy(file(uri))
    .map(CacheUsage::used)
    .orElse(0);
assertEquals(data.length, usedBytes)

Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove this test for now as it's still using Block API. We can add a new one.

@Test
@LocalAlluxioClusterResource.Config(
confParams = {PropertyKey.Name.USER_STREAMING_READER_CHUNK_SIZE_BYTES, "64KB"})
public void readTest1() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this test irrelevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assert.assertTrue(value >= 0);
Assert.assertTrue(value < 256);
Assert.assertTrue(value >= 0 && value < 256);
// Assert.assertTrue(value < 256);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@@ -144,7 +135,7 @@ private List<CreateFilePOptions> getOptionSet() {
@LocalAlluxioClusterResource.Config(
confParams = {PropertyKey.Name.USER_STREAMING_READER_CHUNK_SIZE_BYTES, "64KB"})
public void readTest1() throws Exception {
for (int k = MIN_LEN; k <= MAX_LEN; k += DELTA) {
for (int k = MIN_LEN; k <= MAX_LEN; k += 3 * BLOCK_SIZE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (int k = MIN_LEN; k <= MAX_LEN; k += 3 * BLOCK_SIZE) {
// use a larger step so the test runs faster
for (int k = MIN_LEN; k <= MAX_LEN; k += 3 * BLOCK_SIZE) {

}

@Test
public void syncCacheFirstBlock() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove this test for now as it's still using Block API. We can add a new one.

Copy link
Contributor

@jiacheliu3 jiacheliu3 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the work!

@jiacheliu3 jiacheliu3 added the type-code-quality code quality improvement label Oct 10, 2023
@jiacheliu3
Copy link
Contributor

alluxio-bot, merge this please

@alluxio-bot alluxio-bot merged commit ba61600 into Alluxio:main Oct 10, 2023
14 checks passed
ssz1997 pushed a commit to ssz1997/alluxio that referenced this pull request Dec 15, 2023
Fix `FileInStreamIntegrationTest`, removed unnecessary test cases
			pr-link: Alluxio#18178
			change-id: cid-dac1c4c2e4e403bbf4ad3cbdde9eaf43ce20e046
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-code-quality code quality improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants