Интеграционный тест не проходит в jenkins со встроенным mongodb - PullRequest
0 голосов
/ 21 мая 2019

Я провел свой интеграционный тест локально, все работает нормально. Но когда пытаешься запустить Дженкинса, это не получается. Этот интеграционный тест содержит встроенный mongodb. Интеграционный тест ниже:

@RunWith(SpringRunner.class)
@SpringBootTest
@EnableAutoConfiguration
public class MongoDbSpringUnitTest {

    @Autowired
    PriceRepository priceRepository;

    @Test
    public void testSavePriceMongoRepo() {
        priceRepository.deleteAll();
        Price price = priceRepository.save(new Price("1234productId", 24.5f));

       // System.out.println("id : "+price);
        assertEquals(0,24.5f, price.getCost());
        assertNotNull("id is autogenerate", price.getId());
    }

Ошибка ниже:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'priceController': Unsatisfied dependency expressed through field 'priceRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'priceRepository': Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongoTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'mongoTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDbFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoDbFactorySupport]: Factory method 'mongoDbFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' defined in class path resource 

[org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.flapdoodle.embed.mongo.MongodExecutable]: Factory method 'embeddedMongoServer' threw exception; nested exception is java.lang.IllegalArgumentException: this version does not support 32Bit: Version{3.5.5}:Windows:B32

выше ошибка показывает, что встроенный сервер БД не может быть установлен на 32-битной машине. Я не уверен, что Дженкинс поддерживает только 32-битные. Я использую Дженкинс 2.164.2.

Полный код представлен в github ниже: https://github.com/ranjit5311/MicroServiceCode

Пожалуйста, дайте мне знать, чтобы решить эту проблему.

Спасибо, Ранджит Кумар

1 Ответ

0 голосов
/ 22 мая 2019

После установки новой версии Jenkins 2.164.3, эта проблема решена.

...