You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+29-13Lines changed: 29 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -86,31 +86,49 @@ More examples can be found [here](https://www.conventionalcommits.org/en/v1.0.0/
86
86
87
87
## Code of Conduct and Shared Values
88
88
89
-
Before contributing, please read and approve [our Code Of Conduct](https://github.com/dynatrace/dynatrace-configuration-as-code/blob/main/CODE_OF_CONDUCT.md) outlining our shared values and expectations.
89
+
Before contributing, please read and approve [our Code Of Conduct](./CODE_OF_CONDUCT.md) outlining our shared values and expectations.
90
90
91
91
## Building the Dynatrace Configuration as Code Tool
92
92
93
-
The `monaco` tool is written in [Go](https://golang.org/), so you'll need to have [installed Go](https://golang.org/dl/) to build it.
93
+
This section describes how to build and test Monaco.
94
94
95
-
To build the tool, run `make build` in the repository root folder.
95
+
### Requirements
96
+
* Latest [Go] version
96
97
97
-
**_NOTE:_**`$GOPATH/bin` is required to be loaded in your `$PATH`
98
+
[Go]: https://golang.org/
98
99
99
-
> This guide references the make target for each step. If you want to see the actual Go commands take a look at the [Makefile](./Makefile)
100
+
### Building Monaco
101
+
To build Monaco, execute the following command in the repository root folder:
102
+
```shell
103
+
go build ./cmd/monaco
104
+
```
100
105
101
-
To install the tool to your machine, run `make install` in the repository root folder.
106
+
This command builds the `monaco` executable which then can be executed with:
107
+
```shell
108
+
./monaco version
109
+
```
102
110
103
-
This will create a `monaco` executable you can use.
111
+
### Install Monaco from source
104
112
105
-
To build a platform-specific executable, run: `GOOS={OS} GOARCH={ARCH} make build`.
113
+
To install Monaco from source, execute the following command in the repository root folder:
114
+
```shell
115
+
go install ./cmd/monaco
116
+
```
106
117
107
-
For example, a Windows executable can be built with `GOOS=windows GOARCH=386 make build BINARY=monaco.exe`.
118
+
This will create a `monaco` executable and install it inside the path `$GOBIN` (defaults to `$GOPATH/bin`).
108
119
109
120
## Testing the Dynatrace Configuration as Code Tool
110
121
111
-
Run the unit tests for the whole module with `make test` in the root folder.
122
+
To run the unit tests for Monaco, execute the following commands in the repository root folder:
123
+
```shell
124
+
# Generate mock files
125
+
go generate ./...
112
126
113
-
For convenience, single package tests can be run with `make test-package pkg={PACKAGE}` - e.g. `make test-package pkg=api`.
127
+
# Execute all tests
128
+
go test -tags=unit -v -race ./...
129
+
```ª
130
+
131
+
Note: The `go generate ./...`command must only be executed if the source files changed, not on every test run.
114
132
115
133
### Integration Tests
116
134
@@ -138,8 +156,6 @@ Instead, whenever you need to test a path, make sure to do it in one of these wa
138
156
* Use the public function`ReplacePathSeparators`, which replaces path separators in a given string with `os.PathSeparator`
139
157
140
158
We use [github.com/stretchr/testify](github.com/stretchr/testify) as our testing library.
141
-
142
-
> You might still find `gotest.tools` used for asserts in a few places, as it's being replaced. If you change a test file using it, replace it.
143
159
144
160
We use `require`for asserting test requirements after which it makes no sense to continue - e.g. no error was returned, a slice has the expected length, pointers aren't nil, etc. - as it will fail the test immediately and exit.
0 commit comments