-
Notifications
You must be signed in to change notification settings - Fork 149
Repository maintenance: CI and testing improvements #310
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
Conversation
1bb7ef8
to
9384800
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local and dockerized setup work differently (different networks), so we need to parametrize the test instance and toxiproxy with env variables accordingly. I put this code together that would need to be added to the network_test.go
file to work for both environments:
type proxyConfig struct {
ToxiProxyHost string `env:"TOXIPROXY_HOST" envDefault:"localhost"`
ToxiProxyPort int `env:"TOXIPROXY_PORT" envDefault:"8474"`
ProxyOcppListener string `env:"PROXY_OCPP_LISTENER" envDefault:"localhost:8886"`
ProxyOcppUpstream string `env:"PROXY_OCPP_UPSTREAM" envDefault:"localhost:8887"`
}
and:
func (s *NetworkTestSuite) SetupSuite() {
var cfg proxyConfig
err := env.Parse(&cfg)
if err != nil {
panic(err)
}
endpoint := fmt.Sprintf("%v:%v", cfg.ToxiProxyHost, cfg.ToxiProxyPort)
client := toxiproxy.NewClient(endpoint)
// .....
p, err := client.CreateProxy("ocpp", cfg.ProxyOcppListener, cfg.ProxyOcppUpstream)
require.NoError(s.T(), err)
s.proxy = p
}
This needs a new support lib:
go get github.com/caarlos0/env/v11
@xBlaz3kx Thanks for the PR. If it's too many change requests to handle, do you want me to take the branch over? |
No worries, I will take some time and apply suggested changes. |
I fixed the tests and also improved the testing workflow a bit:
Not sure why coveralls is failing though. |
Proposed changes
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any ofthem, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before
merging your code.
Further comments