Skip to content

Commit

Permalink
Update dependencies (#620)
Browse files Browse the repository at this point in the history
* Fix all imports

* Fix paths in docs

* Update mattermost/server/{public,v8} deps

Commands executed:
  - go get github.com/mattermost/mattermost/server/v8@master
  - go get github.com/mattermost/mattermost/server/public@master
  - go mod tidy

* Fix client methods

* make update-dependencies

Steps taken:
  - Replace server dependencies with latest master locally via go.mod
  replace directives:
     replace github.com/mattermost/mattermost/server/public => ../mattermost/server/public
     replace github.com/mattermost/mattermost/server/v8 => ../mattermost/server
  - Run make update-dependencies
  - Remove the replace directives in go.mod
  - Run go mod tidy

* Fix missing client method
  • Loading branch information
agarciamontoro authored Jul 14, 2023
1 parent 22becda commit 5adac04
Show file tree
Hide file tree
Showing 62 changed files with 319 additions and 1,915 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Mattermost load-test-ng

Mattermost load-test-ng provides a set of tools written in [Go](https://golang.org/) to help profiling [Mattermost](https://github.com/mattermost/mattermost-server) under heavy load, simulating real-world usage of a server installation at scale.
Mattermost load-test-ng provides a set of tools written in [Go](https://golang.org/) to help profiling [Mattermost](https://github.com/mattermost/mattermost) under heavy load, simulating real-world usage of a server installation at scale.

It's a complete rewrite of the [previous](https://github.com/mattermost/mattermost-load-test) load-test tool which served as inspiration.

Expand Down
2 changes: 1 addition & 1 deletion api/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/performance"

"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

func writeAgentResponse(w http.ResponseWriter, status int, resp *client.AgentResponse) {
Expand Down
2 changes: 1 addition & 1 deletion api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/performance"

"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// api keeps track of the load-test API server state.
Expand Down
4 changes: 2 additions & 2 deletions cmd/ltagent/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"time"

"github.com/mattermost/mattermost-server/server/v8/model"
"github.com/mattermost/mattermost/server/public/model"

"github.com/mattermost/mattermost-load-test-ng/api"
"github.com/mattermost/mattermost-load-test-ng/defaults"
Expand All @@ -19,7 +19,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/loadtest/user/userentity"
"github.com/mattermost/mattermost-load-test-ng/logger"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/ltagent/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/loadtest/store/memstore"
"github.com/mattermost/mattermost-load-test-ng/logger"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/ltapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/api"
"github.com/mattermost/mattermost-load-test-ng/logger"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/metricswatcher/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/defaults"
"github.com/mattermost/mattermost-load-test-ng/logger"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/metricswatcher/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/mattermost/mattermost-load-test-ng/cmd/metricswatcher/prometheushealthcheck"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

func healthcheck(errChan chan error, configuration *config.MetricsWatcherConfiguration) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/metricswatcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"

"github.com/mattermost/mattermost-load-test-ng/cmd/metricswatcher/config"
"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/metricswatcher/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/cmd/metricswatcher/config"
"github.com/mattermost/mattermost-load-test-ng/coordinator/performance/prometheus"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

func checkMetrics(errChan chan error, config *config.MetricsWatcherConfiguration) {
Expand Down
2 changes: 1 addition & 1 deletion comparison/comparison.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/deployment"
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

type deploymentConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion comparison/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform"
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

func (c *Comparison) deploymentAction(action func(t *terraform.Terraform, dpConfig *deploymentConfig) error) error {
Expand Down
2 changes: 1 addition & 1 deletion comparison/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform"
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

func (c *Comparison) getLoadTestsCount() int {
Expand Down
2 changes: 1 addition & 1 deletion comparison/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform"
"github.com/mattermost/mattermost-load-test-ng/loadtest/report"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// DeploymentInfo holds information regarding a deployment.
Expand Down
2 changes: 1 addition & 1 deletion coordinator/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/loadtest/control/simulcontroller"
"github.com/wiggin77/merror"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// LoadAgentCluster is the object holding information about all the load-test
Expand Down
2 changes: 1 addition & 1 deletion coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/defaults"
"github.com/mattermost/mattermost-load-test-ng/loadtest"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// Coordinator is the object used to coordinate a cluster of
Expand Down
2 changes: 1 addition & 1 deletion coordinator/performance/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/mattermost/mattermost-load-test-ng/coordinator/performance/prometheus"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

type Monitor struct {
Expand Down
2 changes: 1 addition & 1 deletion deployment/terraform/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"
"github.com/mattermost/mattermost-load-test-ng/loadtest"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

func (t *Terraform) generateLoadtestAgentConfig() (*loadtest.Config, error) {
Expand Down
2 changes: 1 addition & 1 deletion deployment/terraform/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/mattermost/mattermost-load-test-ng/loadtest/control/simplecontroller"
"github.com/mattermost/mattermost-load-test-ng/loadtest/control/simulcontroller"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// StartCoordinator starts the coordinator in the current load-test deployment.
Expand Down
9 changes: 5 additions & 4 deletions deployment/terraform/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package terraform

import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
Expand All @@ -18,9 +19,9 @@ import (
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/assets"
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"

"github.com/mattermost/mattermost-server/server/v8/config"
"github.com/mattermost/mattermost-server/server/v8/model"
"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/v8/config"
)

const cmdExecTimeoutMinutes = 30
Expand Down Expand Up @@ -605,7 +606,7 @@ func pingServer(addr string) error {
case <-timeout:
return fmt.Errorf("timeout after %s, server is not responding", dur)
case <-time.After(3 * time.Second):
status, _, err := client.GetPingWithServerStatus()
status, _, err := client.GetPingWithServerStatus(context.Background())
if err != nil {
mlog.Debug("got error", mlog.Err(err), mlog.String("status", status))
mlog.Info("Waiting for the server...")
Expand Down
2 changes: 1 addition & 1 deletion deployment/terraform/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os/exec"
"strings"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// Destroy destroys the created load-test environment.
Expand Down
2 changes: 1 addition & 1 deletion deployment/terraform/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/mattermost/mattermost-load-test-ng/deployment"
"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"
"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// IngestDump works on an already deployed terraform setup and restores
Expand Down
2 changes: 1 addition & 1 deletion deployment/terraform/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/blang/semver"
"github.com/mattermost/mattermost-load-test-ng/deployment"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

// Config returns the deployment config associated with the Terraform instance.
Expand Down
2 changes: 1 addition & 1 deletion deployment/terraform/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"

"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions deployment/terraform/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (

"github.com/mattermost/mattermost-load-test-ng/deployment/terraform/ssh"

"github.com/mattermost/mattermost-server/server/v8/channels/utils"
"github.com/mattermost/mattermost-server/server/v8/model"
"github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/v8/channels/utils"
)

type uploadInfo struct {
Expand Down
4 changes: 2 additions & 2 deletions docs/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ This is a list of common steps needed when adding new or missing load-test cover

### Update server dependency

If the added feature has new client (as in [`model/client4.go`](https://github.com/mattermost/mattermost-server/blob/master/model/client4.go)) additions, you should update the `mattermost-server` dependency so that the new methods can be used from within the load-test packages.
If the added feature has new client (as in [`model/client4.go`](https://github.com/mattermost/mattermost/blob/master/server/public/model/client4.go)) additions, you should update the `mattermost/server` dependency so that the new methods can be used from within the load-test packages.

```sh
go get -u github.com/mattermost/mattermost-server/server/v8/@COMMIT_HASH
go get -u github.com/mattermost/mattermost/server/v8/@COMMIT_HASH
go mod tidy
```

Expand Down
2 changes: 1 addition & 1 deletion docs/deployer_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ The list of dsn for external database search replicas
*string*

The URL from where to download Mattermost release. This can also point to a local binary path if the user wants to run a load-test on a custom server build.
The path should be prefixed with `file://` and point to the binary of the server (e.g. `file:///home/user/go/src/github.com/mattermost/mattermost-server/bin/mattermost`).
The path should be prefixed with `file://` and point to the binary of the server (e.g. `file:///home/user/go/src/github.com/mattermost/mattermost/server/bin/mattermost`).
Only the binary gets replaced, and the rest of the build comes from the latest stable release.

## MattermostLicenseFile
Expand Down
14 changes: 7 additions & 7 deletions docs/load-test-how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites for load-testing a new feature

- Build and test a feature in a mattermost-server branch.
- Build and test a feature in a `mattermost` branch.
- Scan through markdown docs in [mattermost-load-test-ng](https://github.com/mattermost/mattermost-load-test-ng/tree/master/docs). Make sure you get an idea of what a coordinator, agent, and controller are, what bounded and unbounded load-tests are, and why metrics collection (a deployment of prometheus) is needed in this setup.

## Steps to load test the feature
Expand All @@ -29,7 +29,7 @@ The steps to load test a feature include:
- Go through [local_loadtest.md](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/local_loadtest.md).
- Some additional information on the above document
- Updates to `config.json`
- Make sure to change `ConnectionConfiguration` section in `config.json` according to the local deployment of mattermost-server.
- Make sure to change `ConnectionConfiguration` section in `config.json` according to the local deployment of `mattermost`.
- For `InstanceConfiguration`, see [this doc](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/loadtest_config.md#instanceconfiguration). This configuration setting is used by the `init` command to initially populate the mattermost database.
- Increase the frequency of the new action, so it's easier to debug while running locally. [sample](https://github.com/mattermost/mattermost-load-test-ng/blob/8faa4dfb485dace3bd65908c0d3d98979b7dfd17/loadtest/control/simulcontroller/controller.go#L227)
- If you see errors, there's a [troubleshooting guide](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/faq.md#troubleshooting) you can reference to resolve the issues.
Expand All @@ -44,9 +44,9 @@ The steps to load-test a new feature in production, after testing new actions lo
- Review the [terraform_loadtest.md](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/terraform_loadtest.md) documentation.
- Some additional information on the above document
- When performing [this](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/terraform_loadtest.md#copy-and-modify-the-required-configuration) step, edit `MattermostLicenseFile` value to the path containing the license.
- The fields `MattermostDownloadURL` and `LoadTestDownloadURL` point to the latest `mattermost-server`, and `load-test package`, to be used in the load-test. These are the default options.
- When there's unmerged changes to `mattermost-server`, or `mattermost-load-test-ng`, you need to update these values:
- Run `make build-linux` in the `mattermost-server` directory, change the `MattermostDownloadURL` value to the path containing the Mattermost executable. For example `file:///somepath/mattermost-server/bin/linux_amd64/mattermost`.
- The fields `MattermostDownloadURL` and `LoadTestDownloadURL` point to the latest `mattermost`, and `load-test package`, to be used in the load-test. These are the default options.
- When there's unmerged changes to `mattermost`, or `mattermost-load-test-ng`, you need to update these values:
- Run `make build-linux` in the `mattermost/server` directory, change the `MattermostDownloadURL` value to the path containing the Mattermost executable. For example `file:///somepath/mattermost/server/bin/linux_amd64/mattermost`.
- Run `make package` in the `mattermost-load-test-ng` directory, change `LoadTestDownloadURL` value to the path containing the gzip of the load-test package. For example `file:///somepath/mattermost-load-test-ng/dist/v1.5.0-8-gd4f18cf/mattermost-load-test-ng-v1.5.0-8-gd4f18cf-linux-amd64.tar.gz`.
- Edit `SSHPublicKey` in `deployer.json` after setting up ssh.
- `go run ./cmd/ltctl deployment create`
Expand All @@ -73,7 +73,7 @@ The steps to load-test a new feature in production, after testing new actions lo
#### Analysing load-test results

"My load tests ran successfully, what to make of it?"
- In case of unbounded load-tests, when they finish, `go run ./cmd/ltctl loadtest status` would give you a count of maximum concurrent users which is a metric to compare the performance of that version of mattermost-server.
- In case of unbounded load-tests, when they finish, `go run ./cmd/ltctl loadtest status` would give you a count of maximum concurrent users which is a metric to compare the performance of that version of `mattermost`.
- In case of two bounded loadtests with same `MaxConcurrentUsers` count, one can [generate a report](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/compare.md) comparing performance of various server metrics.
- In case of both bounded and unbounded loadtests, one can create Grafana dashboards to analyze the performance of the new features by filtering API metrics to only what's relevant to the new handler. Here's an example.
![sample-dashboard-creation](https://i.imgur.com/zzRfh8b.png)
Expand All @@ -94,7 +94,7 @@ Even without the framework, a general load-test workflow in the cloud will be si
After all the code changes:
- [Add tests](https://github.com/mattermost/mattermost-load-test-ng/blob/master/docs/coverage.md#testing) if required.
- Run `make check-style`.
- `go get -u github.com/mattermost/mattermost-server/server/v8@<commit-hash-in-master>` && `go mod tidy`
- `go get -u github.com/mattermost/mattermost/server/v8@<commit-hash-in-master>` && `go mod tidy`
- Create the PR.

#### Note:
Expand Down
Loading

0 comments on commit 5adac04

Please sign in to comment.