mirror of
https://github.com/google/nomulus.git
synced 2025-05-31 01:34:05 +02:00
Add a test to verify generated schema (#377)
This commit is contained in:
parent
6af1896362
commit
98414cb7cb
2 changed files with 22 additions and 10 deletions
|
@ -17,7 +17,9 @@ package google.registry.tools;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.io.Resources;
|
||||
import google.registry.persistence.NomulusPostgreSql;
|
||||
import java.io.File;
|
||||
import org.junit.Before;
|
||||
|
@ -86,4 +88,14 @@ public class GenerateSqlSchemaCommandTest extends CommandTestCase<GenerateSqlSch
|
|||
"--start_postgresql", "--out_file=" + tmp.getRoot() + File.separatorChar + "schema.sql");
|
||||
assertThat(new File(tmp.getRoot(), "schema.sql").exists()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateGeneratedSchemaIsSameAsSchemaInFile() throws Exception {
|
||||
runCommand(
|
||||
"--start_postgresql", "--out_file=" + tmp.getRoot() + File.separatorChar + "schema.sql");
|
||||
assertThat(Files.readLines(new File(tmp.getRoot(), "schema.sql"), Charsets.UTF_8))
|
||||
.isEqualTo(
|
||||
Resources.readLines(
|
||||
Resources.getResource("sql/schema/db-schema.sql.generated"), Charsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue