From 04bab36808be9f05b17d3dc2e78cc7169cb3413e Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 9 May 2019 02:24:14 -0700 Subject: [PATCH] Rename .bazelignore file in test data of ManagedDirectoriesBlackBoxTest into bazelignore.test to avoid problems with dot-starting name. PiperOrigin-RevId: 247384048 --- .../devtools/build/lib/blackbox/tests/BUILD | 2 +- .../ManagedDirectoriesBlackBoxTest.java | 30 ++++++++----------- .../{.bazelignore => bazelignore.test} | 0 3 files changed, 14 insertions(+), 18 deletions(-) rename src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/{.bazelignore => bazelignore.test} (100%) diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/BUILD b/src/test/java/com/google/devtools/build/lib/blackbox/tests/BUILD index ebb211001ce660..b5ff79ec365645 100644 --- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/BUILD +++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/BUILD @@ -25,9 +25,9 @@ java_test( timeout = "moderate", srcs = ["manageddirs/ManagedDirectoriesBlackBoxTest.java"], resources = [ - "manageddirs/.bazelignore", "manageddirs/BUILD.test", "manageddirs/WORKSPACE.test", + "manageddirs/bazelignore.test", "manageddirs/package.json", "manageddirs/test_rule.bzl", "manageddirs/use_node_modules.bzl", diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java b/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java index 56a004d42c0b49..0c949c8391575e 100644 --- a/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java +++ b/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/ManagedDirectoriesBlackBoxTest.java @@ -16,7 +16,6 @@ import static com.google.common.truth.Truth.assertThat; -import com.google.common.collect.Lists; import com.google.devtools.build.lib.blackbox.framework.BuilderRunner; import com.google.devtools.build.lib.blackbox.framework.PathUtils; import com.google.devtools.build.lib.blackbox.framework.ProcessResult; @@ -32,14 +31,6 @@ /** Tests for managed directories. */ public class ManagedDirectoriesBlackBoxTest extends AbstractBlackBoxTest { - private static final List FILES = - Lists.newArrayList( - "BUILD.test", - "WORKSPACE.test", - ".bazelignore", - "package.json", - "test_rule.bzl", - "use_node_modules.bzl"); private Random random; private Integer currentDebugId; @@ -341,14 +332,19 @@ public void testRepositoryOverrideChangeToConflictWithManagedDirectories() throw } private void generateProject() throws IOException { - for (String fileName : FILES) { - String text = ResourceFileLoader.loadResource(ManagedDirectoriesBlackBoxTest.class, fileName); - assertThat(text).isNotNull(); - assertThat(text).isNotEmpty(); - fileName = - fileName.endsWith(".test") ? fileName.substring(0, fileName.length() - 5) : fileName; - context().write(fileName, text); - } + writeProjectFile("BUILD.test", "BUILD"); + writeProjectFile("WORKSPACE.test", "WORKSPACE"); + writeProjectFile("bazelignore.test", ".bazelignore"); + writeProjectFile("package.json", "package.json"); + writeProjectFile("test_rule.bzl", "test_rule.bzl"); + writeProjectFile("use_node_modules.bzl", "use_node_modules.bzl"); + } + + private void writeProjectFile(String oldName, String newName) throws IOException { + String text = ResourceFileLoader.loadResource(ManagedDirectoriesBlackBoxTest.class, oldName); + assertThat(text).isNotNull(); + assertThat(text).isNotEmpty(); + context().write(newName, text); } private void checkProjectFiles() throws IOException { diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/.bazelignore b/src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/bazelignore.test similarity index 100% rename from src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/.bazelignore rename to src/test/java/com/google/devtools/build/lib/blackbox/tests/manageddirs/bazelignore.test