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

feat: add magefile #171

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2023 OWASP ModSecurity Core Rule Set Project
# SPDX-License-Identifier: Apache-2.0

FROM alpine:3

RUN apk add --no-cache ca-certificates
Expand Down
3 changes: 3 additions & 0 deletions check/base.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
Expand Down
6 changes: 4 additions & 2 deletions check/base_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
"sort"
"testing"

"github.com/coreruleset/go-ftw/utils"

"github.com/stretchr/testify/suite"

"github.com/coreruleset/go-ftw/config"
"github.com/coreruleset/go-ftw/test"
"github.com/coreruleset/go-ftw/utils"
)

var configMap = map[string]string{
Expand Down
3 changes: 3 additions & 0 deletions check/error.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import "github.com/rs/zerolog/log"
Expand Down
6 changes: 4 additions & 2 deletions check/error_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
"errors"
"testing"

"github.com/coreruleset/go-ftw/utils"

"github.com/stretchr/testify/suite"

"github.com/coreruleset/go-ftw/config"
"github.com/coreruleset/go-ftw/utils"
)

var expectedOKTests = []struct {
Expand Down
3 changes: 3 additions & 0 deletions check/logs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

// AssertNoLogContains returns true is the string is not found in the logs
Expand Down
3 changes: 3 additions & 0 deletions check/logs_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
Expand Down
3 changes: 3 additions & 0 deletions check/response.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
Expand Down
6 changes: 4 additions & 2 deletions check/response_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
"testing"

"github.com/coreruleset/go-ftw/utils"

"github.com/stretchr/testify/suite"

"github.com/coreruleset/go-ftw/config"
"github.com/coreruleset/go-ftw/utils"
)

var expectedResponseOKTests = []struct {
Expand Down
3 changes: 3 additions & 0 deletions check/status.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

// AssertStatus will match the expected status list with the one received in the response
Expand Down
6 changes: 4 additions & 2 deletions check/status_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package check

import (
"testing"

"github.com/coreruleset/go-ftw/utils"

"github.com/stretchr/testify/suite"

"github.com/coreruleset/go-ftw/config"
"github.com/coreruleset/go-ftw/utils"
)

var statusOKTests = []struct {
Expand Down
6 changes: 5 additions & 1 deletion cmd/check.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
"fmt"

"github.com/coreruleset/go-ftw/test"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"

"github.com/coreruleset/go-ftw/test"
)

// NewCheckCmd represents the check command
Expand Down
3 changes: 3 additions & 0 deletions cmd/check_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
Expand Down
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
Expand Down
3 changes: 3 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
Expand Down
8 changes: 5 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
Expand All @@ -9,15 +12,14 @@ import (

"github.com/go-logr/zerologr"
"github.com/rs/zerolog/log"
"wait4x.dev/v2/waiter"

"github.com/spf13/cobra"
"wait4x.dev/v2/checker"
"wait4x.dev/v2/checker/http"
"wait4x.dev/v2/waiter"

"github.com/coreruleset/go-ftw/output"
"github.com/coreruleset/go-ftw/runner"
"github.com/coreruleset/go-ftw/test"
"github.com/spf13/cobra"
)

// NewRunCmd represents the run command
Expand Down
3 changes: 3 additions & 0 deletions cmd/run_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package cmd

import (
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package config

import (
Expand Down
3 changes: 3 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package config

import (
Expand Down
3 changes: 3 additions & 0 deletions config/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package config

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/client_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/connection.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

// Package ftwhttp provides low level abstractions for sending/receiving raw http messages
package ftwhttp

Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/connection_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/header.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/request.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/request_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/response.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

// GetFullResponse gives the full response as string, or nil if there was some error
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/response_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/rtt.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import "time"
Expand Down
3 changes: 3 additions & 0 deletions ftwhttp/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2023 OWASP ModSecurity Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

package ftwhttp

import (
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/icza/backscanner v0.0.0-20220812133752-2e60bffed4a2
github.com/knadh/koanf v1.5.0
github.com/kyokomi/emoji v2.2.4+incompatible
github.com/magefile/mage v1.15.0
github.com/rs/zerolog v1.29.1
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kyokomi/emoji v2.2.4+incompatible h1:np0woGKwx9LiHAQmwZx79Oc0rHpNw3o+3evou4BEPv4=
github.com/kyokomi/emoji v2.2.4+incompatible/go.mod h1:mZ6aGCD7yk8j6QY6KICwnZ2pxoszVseX1DNoGtU2tBA=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand Down
19 changes: 19 additions & 0 deletions mage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2023 OWASP Core Rule Set Project
// SPDX-License-Identifier: Apache-2.0

//go:build ignore
// +build ignore

// Entrypoint to mage for running without needing to install the command.
// https://magefile.org/zeroinstall/
package main

import (
"os"

"github.com/magefile/mage/mage"
)

func main() {
os.Exit(mage.Main())
}
Loading