Skip to content

Commit

Permalink
Resolving pre-commit-hook changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ron96G committed Jun 18, 2021
1 parent 993145c commit 49e8b72
Show file tree
Hide file tree
Showing 23 changed files with 40 additions and 464 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ main
cmd
cmd.exe
libs
node_modules
node_modules
16 changes: 8 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ image: golang:latest
- go get google.golang.org/protobuf/cmd/protoc-gen-go
- go get github.com/envoyproxy/protoc-gen-validate

- 'protoc
-I .
-I ${GOPATH}/src
-I ${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate
--proto_path="./protobuf"
--go_out=":./"
--validate_out="lang=go:."
- 'protoc
-I .
-I ${GOPATH}/src
-I ${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate
--proto_path="./protobuf"
--go_out=":./"
--validate_out="lang=go:."
meta.proto general.proto settings.proto status.proto messages.proto users.proto backup.proto internal.proto'

- chmod 777 -R model
Expand Down Expand Up @@ -114,4 +114,4 @@ build versioned:
stage: build
variables:
TAG: v$VERSION
<<: *build_image
<<: *build_image
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: pretty-format-json
- repo: git://github.com/dnephin/pre-commit-golang
rev: master
hooks:
- id: go-mod-tidy
- id: go-fmt
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ COPY --chown=app:app --from=appBuilder /go/src/github.com/rgumi/whatsapp-mock/ap
VOLUME [ "/home/app/data" ]

EXPOSE 8443/tcp
ENTRYPOINT ["./entrypoint.sh"]
ENTRYPOINT ["./entrypoint.sh"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WhatsApp Business API Mockserver

This repository contains the mockserver for the WhatsApp Business API (WABiz).
This repository contains the mockserver for the WhatsApp Business API (WABiz).
It is used to perform integration-, system- and load-testing.


Expand Down Expand Up @@ -33,7 +33,7 @@ The following list shows the core functionality that is currently supported.
1. Generate inbound traffic with different messages and media
2. Generate stati for outbound traffic
3. Rate limiting
4. (TBD) Validate outbound traffic
4. (TBD) Validate outbound traffic
5. (TBD) strict validation (only allow outbound messages to users that have sent a inbound message)

## Supported Messages
Expand Down Expand Up @@ -62,4 +62,4 @@ Outbound types are accepted by the messages resource and validated.
```bash
cd whatsapp-mock
./build.sh
```
```
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -e

go get -u github.com/swaggo/swag/cmd/swag
go install google.golang.org/protobuf/cmd/protoc-gen-go
Expand Down
2 changes: 1 addition & 1 deletion cmd/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
"document": "document",
"audio": "audio"
}
}
}
2 changes: 1 addition & 1 deletion docs/postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3334,4 +3334,4 @@
"value": ""
}
]
}
}
2 changes: 1 addition & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,4 @@
"in": "header"
}
}
}
}
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ trap 'trap_handler' SIGINT SIGTERM
pid="$!"

echo "App running with pid ${pid}"
wait ${pid}
wait ${pid}
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,20 @@ require (
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1
github.com/envoyproxy/protoc-gen-validate v0.6.1
github.com/fasthttp/router v1.3.14
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.2.0
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.29.0
github.com/rgumi/go-fasthttp-swagger v0.0.0-20210527153122-d4f60e096189
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/securego/gosec/v2 v2.8.1 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/swaggo/swag v1.7.0
github.com/valyala/fasthttp v1.26.0
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6
golang.org/x/tools v0.1.3 // indirect
google.golang.org/protobuf v1.26.0
)
421 changes: 0 additions & 421 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion media/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This file contains different inbound media that are used when generating inbound messages with media attached to them.
This file contains different inbound media that are used when generating inbound messages with media attached to them.
2 changes: 1 addition & 1 deletion protobuf/backup.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ message BackupResponse {
message RestoreRequest {
string password = 1;
bytes data = 2;
}
}
6 changes: 3 additions & 3 deletions protobuf/contacts.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ message Contact {
string name = 1;
}

string wa_id = 1;
string wa_id = 1;
string input = 2;
StatusEnum status = 3;

Expand All @@ -29,11 +29,11 @@ message ContactRequest {
no_wait = 1;
}

BlockingEnum blocking = 1;
BlockingEnum blocking = 1;
repeated string contacts = 2;
bool force_check = 3;
}

message ContactResponse {
repeated Contact contacts = 1;
}
}
2 changes: 1 addition & 1 deletion protobuf/general.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ message MetaResponse {
message ErrorResponse {
meta.Meta meta = 1;
repeated Error errors = 2;
}
}
2 changes: 1 addition & 1 deletion protobuf/internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ message WebhookRequest {
repeated whatsapp.Status statuses = 3;
repeated whatsapp.Error errors = 4;
int32 errorCounter = 5;
}
}
4 changes: 2 additions & 2 deletions protobuf/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ message TemplateMessage {

string type = 1 [(validate.rules).string = {in: ["header", "body", "footer", "button"]}];
string sub_type = 2 [(validate.rules).string = {
ignore_empty: true,
ignore_empty: true,
in: ["quick_reply", "url"]
}];
string index = 3;
Expand Down Expand Up @@ -252,4 +252,4 @@ message Message {

RecipientType recipient_type = 19;
bool preview_url = 20;
}
}
4 changes: 2 additions & 2 deletions protobuf/meta.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum MessageType {
audio = 8;
template = 9;
interactive = 10;
}
}

message Meta {
string version = 1;
Expand All @@ -26,4 +26,4 @@ message Meta {
stable = 3;
}
APIStatus api_status = 2;
}
}
2 changes: 1 addition & 1 deletion protobuf/settings.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ message BusinessProfile {
string email = 3;
string vertical = 4;
repeated string websites = 5;
}
}
4 changes: 2 additions & 2 deletions protobuf/status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ option go_package = "/model";
import "github.com/envoyproxy/protoc-gen-validate/validate/validate.proto";

message Status {
string id = 1;
string id = 1;
enum StatusEnum {
unknown = 0;
sent = 1;
Expand All @@ -14,4 +14,4 @@ message Status {
StatusEnum status = 2;
string recipient_id = 3;
int64 timestamp = 4;
}
}
2 changes: 1 addition & 1 deletion protobuf/users.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ message ChangePwdRequest {
message User {
string username = 1 [(validate.rules).string.min_len = 5];
string password = 2 [(validate.rules).string.min_len = 8];
}
}
4 changes: 2 additions & 2 deletions test/k6/loadtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function () {
},
};
let res = http.post(baseUrl+'/users/login', {},params);

check(res, {
'status is 200': (r) => r.status === 200
});
Expand All @@ -40,4 +40,4 @@ export default function () {
};

res = http.post(baseUrl+'/messages', payload, params);
}
}

0 comments on commit 49e8b72

Please sign in to comment.