DevOps Manual Set up - Set 1 Flashcards

1
Q

What does the mvn package command do in your project directory from the terminal?

A

Compiles the source code, runs tests, and packages the project, creating a distributable JAR or WAR file based on the project configuration in Maven.

mvn package generates the initial artifact.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

What is Spring Boot Maven Plugin?

A

The Spring Boot Maven Plugin simplifies building and running Spring Boot applications, handling tasks like packaging, running, and creating executable JARs.

This plugin automates many configuration steps, simplifying the development and deployment of Spring Boot projects within the Maven ecosystem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the repackage goal from Spring Boot Maven Plugin do?

A

The “repackage” goal changes an existing JAR or WAR by embedding dependencies.

repackage modifies or enhances an existing artifact.

It creates a self-contained executable artifact. This executable artifact can be run directly without requiring external dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the mvn clean command do in your project directory from the terminal?

A

The mvn clean command removes the generated build artifacts and cleans the project directory, erasing compiled classes, resources, and temporary build files, ensuring a fresh build.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to start a spring boot application using the .jar file on the terminal?

A

java -jar target/[name of the jar file].jar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the purpose of Maven Surefire Plugin?

A

The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates detailed reports and ensuring code stability.

Generates two file formats:

  • Plain text files *.txt
  • XML files *.xml

Default: Files are generated in ${basedir}/target/surefire-reports/TEST-*.xml.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to isolate unit tests with maven-surefire-plugin and why?

A

Exclude integration tests by targeting the project naming convention for integration tests:

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<configuration>

<excludes>

<exclude>**/*IntegrationTest</exclude>

</excludes>

</configuration>

</plugin>

Excluding integration tests from Surefire Plugin speeds up unit testing feedback, isolates unit testing, and avoids dependencies (external systems, databases, or services), enhancing agile development cycles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In a Spring Boot application using the spring-boot-starter-parent, how do you package the application as an executable JAR with all its dependencies?

A

spring-boot-maven-plugin is included in the spring-boot-starter-parent in your pom.xml. Running mvn package will then produce an executable JAR with embedded dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of Maven Failsafe Plugin?

A

Maven Failsafe Plugin runs integration tests (e.g., database, server) in a separate phase, ensuring application components work together, validating real-world functionality without interfering with unit tests during the build.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In which phase of the build lifecyle, unit and integration tests are run?

A

Unit tests are run in the test phase.

Integration tests are run by default by Maven Failsafe Plugin during the integration-test phase, before the verify phase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How many phases are there in the Maven lifecycle for running integration tests?

A

1) pre-integration-test

2) integration-test

3) post-integration-test

4) verify

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which plugins and configurations are necessary for setting up integration tests in a Spring Boot application?

A
  • Build helper within spring-boot-maven-plugin: Configure a random port for the server during integration tests.
  • Also within spring-boot-maven-plugin: Starts/stops the application before and after integration tests.
  • Within maven-surefire-plugin: Excludes integration tests during the unit test phase.
  • Within maven-failsafe-plugin: Configures and runs the actual integration tests.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Docker?

A
  • Platform for building, running and shipping applications
  • Developers can easily build and deploy applications running in containers
  • Local development is the same across any environment
  • Used a lot in CI/CD workflows
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are Virtual Machines?

A

Virtual Machines (VMs) are software emulations of physical computers. They run operating systems and applications, creating isolated environments within a host system, enabling multiple OS instances on a single hardware system.

Virtual machines are running on and sharing resources with a physical computer, which is called the host. The host system provides the resources (like CPU, memory, storage) and environment for these virtual machines to operate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly