2727import org .apache .amoro .TableRuntime ;
2828import org .apache .amoro .config .DataExpirationConfig ;
2929import org .apache .amoro .config .TableConfiguration ;
30+ import org .apache .amoro .config .TagConfiguration ;
3031import org .apache .amoro .process .LocalExecutionEngine ;
3132import org .apache .amoro .process .ProcessTriggerStrategy ;
3233import org .apache .amoro .process .RecoverProcessFailedException ;
@@ -67,6 +68,8 @@ public void testTriggerActionWhenDue() {
6768 DanglingDeleteFilesCleaningProcess .class ,
6869 0 );
6970 assertTriggerWhenDue ("expire-data" , IcebergActions .EXPIRE_DATA , DataExpiringProcess .class , 0 );
71+ assertTriggerWhenDue (
72+ "auto-create-tags" , IcebergActions .AUTO_CREATE_TAGS , TagsAutoCreatingProcess .class , 0 );
7073 }
7174
7275 @ Test
@@ -89,6 +92,7 @@ public void testTriggerActionDisabled() {
8992 assertTriggerDisabled (
9093 "clean-dangling-delete-files" , IcebergActions .CLEAN_DANGLING_DELETE , false , 0 );
9194 assertTriggerDisabled ("expire-data" , IcebergActions .EXPIRE_DATA , false , 0 );
95+ assertTriggerDisabled ("auto-create-tags" , IcebergActions .AUTO_CREATE_TAGS , false , 0 );
9296 }
9397
9498 @ Test
@@ -116,6 +120,12 @@ public void testRecoverDataExpiringProcess() {
116120 assertRecover ("expire-data" , IcebergActions .EXPIRE_DATA , DataExpiringProcess .class );
117121 }
118122
123+ @ Test
124+ public void testRecoverAutoCreateTagProcess () {
125+ assertRecover (
126+ "auto-create-tags" , IcebergActions .AUTO_CREATE_TAGS , TagsAutoCreatingProcess .class );
127+ }
128+
119129 @ Test
120130 public void testRecoverUnsupportedActionThrows () {
121131 IcebergProcessFactory factory = openedFactory ("expire-snapshots" );
@@ -258,6 +268,10 @@ private TableRuntime createRuntime(String configKey, boolean enabled, long lastT
258268 tableConfiguration .setDeleteDanglingDeleteFilesEnabled (enabled );
259269 } else if ("expire-data" .equals (configKey )) {
260270 tableConfiguration .setExpiringDataConfig (new DataExpirationConfig ().setEnabled (enabled ));
271+ } else if ("auto-create-tags" .equals (configKey )) {
272+ TagConfiguration tagConfiguration = new TagConfiguration ();
273+ tagConfiguration .setAutoCreateTag (enabled );
274+ tableConfiguration .setTagConfiguration (tagConfiguration );
261275 }
262276
263277 TableRuntimeCleanupState cleanupState = new TableRuntimeCleanupState ();
@@ -274,7 +288,9 @@ private TableRuntime createRuntime(String configKey, boolean enabled, long lastT
274288 TableRuntime runtime = mock (TableRuntime .class );
275289 doReturn (tableConfiguration ).when (runtime ).getTableConfiguration ();
276290 doReturn (cleanupState ).when (runtime ).getState (DefaultTableRuntime .CLEANUP_STATE_KEY );
277-
291+ if ("auto-create-tags" .equals (configKey )) {
292+ doReturn (TableFormat .ICEBERG ).when (runtime ).getFormat ();
293+ }
278294 return runtime ;
279295 }
280296}
0 commit comments