JuyeoungJun / log-consumer

cron monitoring log-consumer server
0 stars 0 forks source link

Job Failed #317517 #9

Closed JuyeoungJun closed 3 years ago

JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 13, 2021, 11:40

개요

버그 내용

CronLogRepositoryImplTest > save FAILED
    java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException at ConstructorResolver.java:800
            Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException at ConstructorResolver.java:800
                Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException at ConfigurationPropertiesBindingPostProcessor.java:92
                    Caused by: org.springframework.boot.context.properties.bind.BindException at Binder.java:384
                        Caused by: org.springframework.beans.factory.BeanCreationException at AutowiredAnnotationBeanPostProcessor.java:405
                            Caused by: java.lang.IllegalArgumentException at PropertyPlaceholderHelper.java:180

버그 재현 코드

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("dev_env")
public class CronLogRepositoryImplTest {

    @Autowired
    CronLogRepository cronLogRepository;

    @Test
    public void save() {
        // Given
        CronLog cronLog = CronLog.builder()
            .logTime(Instant.now())
            .log("test")
            .cronProcess("test")
            .build();
        // When
        CronLog savedLog = cronLogRepository.save(cronLog);
        // Then
        assertThat(cronLog).isEqualTo(savedLog);
    }
}

해결 방안

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("prod")
public class CronLogRepositoryImplTest {

    @Autowired
    CronLogRepository cronLogRepository;

    @Test
    public void save() {
        // Given
        CronLog cronLog = CronLog.builder()
            .logTime(Instant.now())
            .log("test")
            .cronProcess("test")
            .build();
        // When
        CronLog savedLog = cronLogRepository.save(cronLog);
        // Then
        assertThat(cronLog).isEqualTo(savedLog);
    }
}
JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 13, 2021, 11:44

changed the description

JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 13, 2021, 11:45

changed the description

JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 13, 2021, 12:03

changed the description

JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 13, 2021, 12:56

mentioned in merge request !9