Skip to content

Commit

Permalink
#331 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Aug 3, 2022
1 parent 0ad2e03 commit 1838c10
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ private void assertGeneratedFiles() throws IOException {
final String changelog = Files
.readString(this.projectDir.resolve("doc/changes/changes_" + this.fixture.getProjectVersion() + ".md"));
assertThat(changelog, allOf(containsString("* Added `golang:1.17`"),
containsString("* Added `github.com/exasol/exasol-driver-go:v0.4.0`"), //
containsString(
"* Added `github.com/exasol/exasol-test-setup-abstraction-server/go-client:v0.0.0-20220520062645-0dd00179907c`")));
containsString("* Added `github.com/exasol/exasol-driver-go:v0.4.3`"), //
containsString("* Added `github.com/exasol/exasol-test-setup-abstraction-server/go-client:v0.2.2`")));
assertThat(dependencies, allOf(containsString("github.com/exasol/exasol-driver-go | [MIT][0]"), //
containsString("| github.com/exasol/exasol-test-setup-abstraction-server/go-client | [MIT][1]")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ private GolangDependencyLicense license(final String moduleName, final String li
}

private void simulateMainModuleLicenses(final Map<String, GolangDependencyLicense> licenses) {
simulateLicenses("./...", licenses);
when(this.golangServicesMock.getLicenses(PROJECT_PATH, "./...")).thenReturn(licenses);
}

private void simulateLicenses(final String moduleName, final Map<String, GolangDependencyLicense> licenses) {
when(this.golangServicesMock.getLicenses(PROJECT_PATH, moduleName)).thenReturn(licenses);
final Path modulePath = Paths.get("modulePath");
when(this.golangServicesMock.getModuleDir(PROJECT_PATH, moduleName)).thenReturn(modulePath);
when(this.golangServicesMock.getLicenses(modulePath, moduleName)).thenReturn(licenses);
}

private List<ProjectDependency> calculate(final Dependency... goModDependencies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ private DependencyChange updatedDep(final String name, final String oldVersion,

private void assertDependencyLicenses(final List<ProjectDependency> dependencies) {
final ProjectDependency dependency1 = ProjectDependency.builder().name("github.com/exasol/exasol-driver-go")
.licenses(List.of(new License("MIT", "https://github.com/exasol/exasol-driver-go/blob/v0.4.0/LICENSE")))
.licenses(List.of(new License("MIT", "https://github.com/exasol/exasol-driver-go/blob/v0.4.3/LICENSE")))
.type(Type.COMPILE).build();
final ProjectDependency dependency2 = ProjectDependency.builder()
.name("github.com/exasol/exasol-test-setup-abstraction-server/go-client")
.licenses(List.of(new License("MIT",
"https://github.com/exasol/exasol-test-setup-abstraction-server/blob/0dd00179907c/go-client/LICENSE")))
"https://github.com/exasol/exasol-test-setup-abstraction-server/blob/HEAD/go-client/LICENSE")))
.type(Type.TEST).build();
assertAll(() -> assertThat(dependencies, hasSize(2)),
() -> assertThat(dependencies, contains(dependency1, dependency2)));
() -> assertThat(dependencies, containsInAnyOrder(dependency1, dependency2)));
}

private AnalyzedSource analyzeSingleProject(final ProjectKeeperConfig config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ void initializeGitRepo() throws GitAPIException {
}

private void writeGoModFile(final Path moduleDir, final String goVersion) {
final List<String> dependencies = List.of("github.com/exasol/exasol-driver-go v0.3.1",
"github.com/exasol/exasol-test-setup-abstraction-server/go-client v0.0.0-20220520062645-0dd00179907c",
final List<String> dependencies = List.of("github.com/exasol/exasol-driver-go v0.4.3",
"github.com/exasol/exasol-test-setup-abstraction-server/go-client v0.2.2",
"github.com/exasol/error-reporting-go v0.1.1 // indirect");
final String content = "module " + GO_MODULE_NAME + "\n" //
+ "go " + goVersion + "\n" //
Expand Down

0 comments on commit 1838c10

Please sign in to comment.