Skip to content

Commit

Permalink
[apache#722] improvement: Cleanup residue files in tmp directory for …
Browse files Browse the repository at this point in the history
…integration-test/spark-common
  • Loading branch information
cchung100m committed Aug 19, 2023
1 parent 80c3f24 commit 9c01d9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Map;
import java.util.Random;
Expand All @@ -33,13 +32,16 @@
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.sql.SparkSession;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class RepartitionTest extends SparkIntegrationTestBase {

private static final Logger LOG = LoggerFactory.getLogger(RepartitionTest.class);

static @TempDir File tempDir;

@Test
public void resultCompareTest() throws Exception {
run();
Expand All @@ -63,7 +65,6 @@ public void updateSparkConfCustomer(SparkConf sparkConf) {
public abstract void updateRssStorage(SparkConf sparkConf);

protected String generateTextFile(int wordsPerRow, int rows) throws Exception {
String tempDir = Files.createTempDirectory("rss").toString();
File file = new File(tempDir, "wordcount.txt");
file.createNewFile();
LOG.info("Create file:" + file.getAbsolutePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.util.Map;
import java.util.Random;

Expand All @@ -31,13 +30,16 @@
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class SparkSQLTest extends SparkIntegrationTestBase {

private static final Logger LOG = LoggerFactory.getLogger(SparkSQLTest.class);

static @TempDir File tempDir;

@Test
public void resultCompareTest() throws Exception {
run();
Expand Down Expand Up @@ -76,7 +78,6 @@ public void updateSparkConfCustomer(SparkConf sparkConf) {

protected String generateCsvFile() throws Exception {
int rows = 1000;
String tempDir = Files.createTempDirectory("rss").toString();
File file = new File(tempDir, "test.csv");
file.createNewFile();
LOG.info("Create file:" + file.getAbsolutePath());
Expand Down

0 comments on commit 9c01d9f

Please sign in to comment.