From 6d52bef8fc1ec6ac0629efa3d25a01c74da749b7 Mon Sep 17 00:00:00 2001 From: Xinze Guo <101622833+azexcy@users.noreply.github.com> Date: Wed, 22 Nov 2023 16:55:51 +0800 Subject: [PATCH] Persist valid job config --- .../job/service/GovernanceRepositoryAPIImplTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java index ecf3fe879cd74..7806cda61dcb9 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java @@ -31,6 +31,8 @@ import org.apache.shardingsphere.data.pipeline.core.task.PipelineTaskUtils; import org.apache.shardingsphere.data.pipeline.scenario.migration.config.MigrationTaskConfiguration; import org.apache.shardingsphere.data.pipeline.scenario.migration.context.MigrationJobItemContext; +import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO; +import org.apache.shardingsphere.infra.util.yaml.YamlEngine; import org.apache.shardingsphere.mode.event.DataChangedEvent; import org.apache.shardingsphere.mode.event.DataChangedEvent.Type; import org.apache.shardingsphere.mode.manager.ContextManager; @@ -85,10 +87,11 @@ private static void watch() { @Test void assertIsJobConfigurationExisted() { assertFalse(governanceRepositoryAPI.isJobConfigurationExisted("foo_job")); - getClusterPersistRepository().persist("/pipeline/jobs/foo_job/config", "foo"); + JobConfigurationPOJO value = new JobConfigurationPOJO(); + value.setJobName("foo_job"); + value.setShardingTotalCount(1); + getClusterPersistRepository().persist("/pipeline/jobs/foo_job/config", YamlEngine.marshal(value)); assertTrue(governanceRepositoryAPI.isJobConfigurationExisted("foo_job")); - getClusterPersistRepository().delete("/pipeline/jobs/foo_job/config"); - assertFalse(governanceRepositoryAPI.isJobConfigurationExisted("foo_job")); } @Test