Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(buf): set correct prefix for api #4198

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
- [#4091](https://github.com/ignite/cli/pull/4091) Fix race conditions in the plugin logic
- [#4128](https://github.com/ignite/cli/pull/4128) Check for duplicate proto fields in config
- [#4184](https://github.com/ignite/cli/pull/4184) Set custom `InitChainer` because of manually registered modules
- [#4198](https://github.com/ignite/cli/pull/4198) Set correct prefix overwriting in `buf.gen.pulsar.yaml`

## [`v28.4.0`](https://github.com/ignite/cli/releases/tag/v28.4.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ version: v1
managed:
enabled: true
go_package_prefix:
default: cosmossdk.io/api
default: <%= ModulePath %>/api
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved
except:
- buf.build/googleapis/googleapis
- buf.build/cosmos/gogo-proto
- buf.build/cosmos/cosmos-proto
override:
buf.build/cosmos/cosmos-sdk: cosmossdk.io/api
plugins:
- name: go-pulsar
out: ./api
Expand Down
20 changes: 20 additions & 0 deletions integration/app/cmd_proto_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package app_test
import (
"os"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -58,6 +59,25 @@ var (
}
)

// TestGenerapAppCheckBufPulsarPath tests scaffolding a new chain and checks if the buf.gen.pulsar.yaml file is correct
func TestGenerapAppCheckBufPulsarPath(t *testing.T) {
var (
env = envtest.New(t)
app = env.Scaffold("github.com/test/blog")
)

bufGenPulsarPath := filepath.Join(app.SourcePath(), "proto", "buf.gen.pulsar.yaml")
_, statErr := os.Stat(bufGenPulsarPath)
require.False(t, os.IsNotExist(statErr), "buf.gen.pulsar.yaml should be scaffolded")

result, err := os.ReadFile(bufGenPulsarPath)
require.NoError(t, err)

require.True(t, strings.Contains(string(result), "default: github.com/test/blog/api"), "buf.gen.pulsar.yaml should contain the correct api override")

app.EnsureSteady()
}

func TestChangeProtoPath(t *testing.T) {
var (
env = envtest.New(t)
Expand Down
Loading