Skip to content

Commit

Permalink
Fixed roll forward logic that broke unit test
Browse files Browse the repository at this point in the history
[#167857066]
  • Loading branch information
ForestEckhardt committed Aug 30, 2019
1 parent e99b316 commit d2bfc96
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
32 changes: 17 additions & 15 deletions src/dotnetcore/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,29 +463,31 @@ func (p *Project) versionsFromNugetPackages(dependency string, rollForward bool)
}

func (p *Project) installAspNetCoreDependency(version string, latestPatch bool) error {
semverObj, err := semver.Parse(version)
if err != nil {
return err
}

if semverObj.Major <= 2 && semverObj.Minor < 1 {
if latestPatch {
version, err = p.rollForward("dotnet-aspnetcore", version)
if err != nil {
return err
}
}
}
var rollForwardVersion string
var err error

if latestPatch {
version, err = p.rollForward("dotnet-aspnetcore", version)
rollForwardVersion, err = p.rollForward("dotnet-aspnetcore", version)
if err != nil {
return err
}
}

if rollForwardVersion == "" {
return nil
}

semverObj, err := semver.Parse(rollForwardVersion)
if err != nil {
return err
}

if semverObj.Major <= 2 && semverObj.Minor < 1 {
return nil
}

return p.installer.InstallDependency(
libbuildpack.Dependency{Name: "dotnet-aspnetcore", Version: version},
libbuildpack.Dependency{Name: "dotnet-aspnetcore", Version: rollForwardVersion},
filepath.Join(p.depDir, "dotnet-sdk"),
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/dotnetcore/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,15 @@ var _ = Describe("Project", func() {
It("it will not install old 2.0 version of dotnet-aspnetcore", func() {
mockManifest.
EXPECT().
AllDependencyVersions("dotnet-aspnetcore").
Times(0)
AllDependencyVersions("dotnet-aspnetcore").Return([]string{"2.0.0"})

mockInstaller.
EXPECT().
InstallDependency(gomock.Any(), gomock.Any()).
Times(0)

Expect(subject.SourceInstallDotnetAspNetCore()).To(Succeed())

})
})
})
Expand Down

0 comments on commit d2bfc96

Please sign in to comment.