Skip to content
Permalink
Browse files
refactory: making merges with pro easier (#3400)
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Sep 25, 2022
1 parent 5058540 commit a8b3806e7efee6912d9a93395d6501b3f0b5f0d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
@@ -113,7 +113,7 @@ func releaseProject(options releaseOpts) (*context.Context, error) {
})
}

func setupReleaseContext(ctx *context.Context, options releaseOpts) *context.Context {
func setupReleaseContext(ctx *context.Context, options releaseOpts) {
ctx.Parallelism = runtime.NumCPU()
if options.parallelism > 0 {
ctx.Parallelism = options.parallelism
@@ -141,5 +141,4 @@ func setupReleaseContext(ctx *context.Context, options releaseOpts) *context.Con

// test only
ctx.Deprecated = options.deprecated
return ctx
}
@@ -54,12 +54,15 @@ func TestReleaseBrokenProject(t *testing.T) {
}

func TestReleaseFlags(t *testing.T) {
setup := func(opts releaseOpts) *context.Context {
return setupReleaseContext(context.New(config.Project{}), opts)
setup := func(tb testing.TB, opts releaseOpts) *context.Context {
tb.Helper()
ctx := context.New(config.Project{})
setupReleaseContext(ctx, opts)
return ctx
}

t.Run("snapshot", func(t *testing.T) {
ctx := setup(releaseOpts{
ctx := setup(t, releaseOpts{
snapshot: true,
})
require.True(t, ctx.Snapshot)
@@ -69,7 +72,7 @@ func TestReleaseFlags(t *testing.T) {
})

t.Run("skips", func(t *testing.T) {
ctx := setup(releaseOpts{
ctx := setup(t, releaseOpts{
skipPublish: true,
skipSign: true,
skipValidate: true,
@@ -81,7 +84,7 @@ func TestReleaseFlags(t *testing.T) {
})

t.Run("parallelism", func(t *testing.T) {
require.Equal(t, 1, setup(releaseOpts{
require.Equal(t, 1, setup(t, releaseOpts{
parallelism: 1,
}).Parallelism)
})
@@ -90,7 +93,7 @@ func TestReleaseFlags(t *testing.T) {
notes := "foo.md"
header := "header.md"
footer := "footer.md"
ctx := setup(releaseOpts{
ctx := setup(t, releaseOpts{
releaseNotesFile: notes,
releaseHeaderFile: header,
releaseFooterFile: footer,
@@ -104,7 +107,7 @@ func TestReleaseFlags(t *testing.T) {
notes := "foo.md"
header := "header.md"
footer := "footer.md"
ctx := setup(releaseOpts{
ctx := setup(t, releaseOpts{
releaseNotesTmpl: notes,
releaseHeaderTmpl: header,
releaseFooterTmpl: footer,
@@ -115,7 +118,7 @@ func TestReleaseFlags(t *testing.T) {
})

t.Run("rm dist", func(t *testing.T) {
require.True(t, setup(releaseOpts{
require.True(t, setup(t, releaseOpts{
rmDist: true,
}).RmDist)
})

0 comments on commit a8b3806

Please sign in to comment.