Skip to content

Commit

Permalink
Fikset feilende tester i Dolly-backend
Browse files Browse the repository at this point in the history
#deploy-test-dolly-backend
  • Loading branch information
stigus committed Oct 17, 2023
1 parent db6d0cc commit 242209f
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -44,7 +43,7 @@

@SpringBootTest(webEnvironment = RANDOM_PORT)
@ActiveProfiles("test")
@Testcontainers(disabledWithoutDocker = true)
@Testcontainers(disabledWithoutDocker = true, parallel = true)
@EnableAutoConfiguration
@ComponentScan("no.nav.dolly")
@AutoConfigureMockMvc(addFilters = false)
Expand Down Expand Up @@ -99,10 +98,8 @@ public void beforeEach() {
MockedJwtAuthenticationTokenUtils.setJwtAuthenticationToken();
}

@Transactional
@AfterEach
public void afterEach() {
deleteAllDatabaseContent();
MockedJwtAuthenticationTokenUtils.clearJwtAuthenticationToken();
}

Expand Down Expand Up @@ -219,14 +216,4 @@ Testgruppe saveDummyGruppe() {
void saveDummyBruker(Bruker bruker) {
brukerRepository.save(bruker);
}

void deleteAllDatabaseContent() {
bestillingMalRepository.deleteAll();
identRepository.deleteAll();
bestillingRepository.deleteAll();
brukerFavoritterRepository.deleteAll();
testgruppeRepository.findAll(Sort.unsorted()).forEach(gruppe -> testgruppeRepository.deleteTestgruppeById(gruppe.getId()));
brukerRepository.deleteByBrukerId(DUMMY_EN.getBrukerId());
brukerRepository.deleteByBrukerId(DUMMY_TO.getBrukerId());
}
}

0 comments on commit 242209f

Please sign in to comment.