@@ -1848,7 +1848,7 @@ protected void assertRollbackTo(
18481848 @ Test
18491849 public void testRollbackSchemaSuccess () throws Exception {
18501850 FileStoreTable table = createFileStoreTable ();
1851- SchemaManager schemaManager = new SchemaManager ( LocalFileIO . create (), tablePath );
1851+ SchemaManager schemaManager = table . schemaManager ( );
18521852 long firstSchemaId = schemaManager .latest ().get ().id ();
18531853
18541854 // evolve schema twice
@@ -1867,7 +1867,7 @@ public void testRollbackSchemaSuccess() throws Exception {
18671867 @ Test
18681868 public void testRollbackSchemaFailedWithSnapshotReference () throws Exception {
18691869 FileStoreTable table = createFileStoreTable ();
1870- SchemaManager schemaManager = new SchemaManager ( LocalFileIO . create (), tablePath );
1870+ SchemaManager schemaManager = table . schemaManager ( );
18711871 long firstSchemaId = schemaManager .latest ().get ().id ();
18721872
18731873 // write data to create a snapshot referencing firstSchemaId
@@ -1880,10 +1880,9 @@ public void testRollbackSchemaFailedWithSnapshotReference() throws Exception {
18801880
18811881 // evolve schema
18821882 schemaManager .commitChanges (SchemaChange .setOption ("aa" , "bb" ));
1883- long secondSchemaId = schemaManager .latest ().get ().id ();
18841883
18851884 // write data to create a snapshot referencing secondSchemaId
1886- table = createFileStoreTable ();
1885+ table = table . copyWithLatestSchema ();
18871886 write = table .newWrite (commitUser );
18881887 commit = table .newCommit (commitUser );
18891888 write .write (rowData (1 , 10 , 100L ));
@@ -1894,7 +1893,6 @@ public void testRollbackSchemaFailedWithSnapshotReference() throws Exception {
18941893 // rollback should fail because snapshot references secondSchemaId
18951894 FileStoreTable finalTable = table ;
18961895 assertThatThrownBy (() -> finalTable .rollbackSchema (firstSchemaId ))
1897- .hasMessageContaining ("Cannot rollback to schema " + firstSchemaId )
1898- .hasMessageContaining ("schema " + secondSchemaId + " is still referenced" );
1896+ .hasMessageContaining ("Cannot rollback to schema" );
18991897 }
19001898}
0 commit comments