Skip to content

Test/add runtime manager tests #2175

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

Merged
merged 28 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
65f6bd3
add tests for runtime manager
miledxz Jul 7, 2024
b98942e
adding required tests update
miledxz Jul 7, 2024
266fdc0
resolving conflicts
miledxz Jul 7, 2024
676548c
adding resolving conflicts
miledxz Jul 7, 2024
88f656f
adding additional updates with Reload fnction tests
miledxz Feb 26, 2024
93157b9
adding required updates
miledxz Mar 12, 2024
df5ccbe
adding fixes
miledxz May 6, 2024
3dc727a
adding processHandler struct update
miledxz May 20, 2024
a0c0228
adding cleanup fix update
miledxz May 20, 2024
596efd3
adding gofumpt fix update
miledxz May 20, 2024
54e1efe
adding additional fix updates
miledxz May 20, 2024
39cc3d7
adding tests for runtime manager
miledxz Jun 27, 2024
7f6d1bf
resolving partionally comments in pr
miledxz Jun 29, 2024
9777319
Merge branch 'nginxinc:main' into test/add-runtime-manager-tests
miledxz Jul 7, 2024
0ecf5d1
adding first part of resolving final comments
miledxz Jul 7, 2024
ecc39c5
experimental commit for NewProcessHandlerImpl
miledxz Jul 7, 2024
948b9be
Merge branch 'nginxinc:main' into test/add-runtime-manager-tests
miledxz Jul 13, 2024
f146435
updating test desc
miledxz Jul 13, 2024
b7884d0
adding required updates regarding readFile
miledxz Jul 13, 2024
04f6e30
adding additional experimental ReadFile update
miledxz Jul 13, 2024
6963fd4
adding general fix for manager
miledxz Jul 14, 2024
547e903
adding small fix update
miledxz Aug 10, 2024
27fed56
adding manager fix update
miledxz Aug 20, 2024
8b94a05
quick upstream test update
miledxz Aug 20, 2024
eda39b2
Merge branch 'main' into test/add-runtime-manager-tests
kate-osborn Aug 20, 2024
7be17ee
experimental fix
miledxz Aug 21, 2024
1a56441
adding lint fix update
miledxz Aug 29, 2024
8913e20
Merge branch 'main' into test/add-runtime-manager-tests
sjberman Aug 29, 2024
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
Prev Previous commit
Next Next commit
experimental fix
  • Loading branch information
miledxz committed Aug 21, 2024
commit 7be17ee37e430947252a47e0ebdbf9e49491eb88
3 changes: 1 addition & 2 deletions internal/mode/static/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"time"

"github.com/go-logr/logr"
ngxclient "github.com/nginxinc/nginx-plus-go-client/client"
tel "github.com/nginxinc/telemetry-exporter/pkg/telemetry"
"github.com/prometheus/client_golang/prometheus"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
Expand Down Expand Up @@ -49,7 +48,7 @@
"github.com/nginxinc/nginx-gateway-fabric/internal/framework/status"
ngftypes "github.com/nginxinc/nginx-gateway-fabric/internal/framework/types"
"github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/config"
"github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/metrics/collectors"

Check failure on line 51 in internal/mode/static/manager.go

View workflow job for this annotation

GitHub Actions / Go Lint (.)

could not import github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/metrics/collectors (-: # github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/metrics/collectors
ngxcfg "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/nginx/config"
"github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/nginx/config/policies"
"github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/nginx/config/policies/clientsettings"
Expand Down Expand Up @@ -159,7 +158,7 @@
handlerCollector handlerMetricsCollector = collectors.NewControllerNoopCollector()
)

var ngxPlusClient *ngxclient.NginxClient
var ngxPlusClient ngxruntime.NginxPlusClient
var usageSecret *usage.Secret

if cfg.Plus {
Expand Down
3 changes: 1 addition & 2 deletions internal/mode/static/metrics/collectors/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import (
"github.com/go-kit/log"
"github.com/nginxinc/nginx-plus-go-client/client"
prometheusClient "github.com/nginxinc/nginx-prometheus-exporter/client"
nginxCollector "github.com/nginxinc/nginx-prometheus-exporter/collector"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -26,12 +25,12 @@

// NewNginxPlusMetricsCollector creates an NginxCollector which fetches stats from NGINX Plus API over a unix socket.
func NewNginxPlusMetricsCollector(
plusClient *client.NginxClient,
plusClient runtime.NginxPlusClient,
constLabels map[string]string,
logger log.Logger,
) (prometheus.Collector, error) {
collector := nginxCollector.NewNginxPlusCollector(
plusClient,

Check failure on line 33 in internal/mode/static/metrics/collectors/nginx.go

View workflow job for this annotation

GitHub Actions / Go Lint (.)

cannot use plusClient (variable of type "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/nginx/runtime".NginxPlusClient) as *"github.com/nginxinc/nginx-plus-go-client/client".NginxClient value in argument to nginxCollector.NewNginxPlusCollector: need type assertion (typecheck)

Check failure on line 33 in internal/mode/static/metrics/collectors/nginx.go

View workflow job for this annotation

GitHub Actions / Go Lint (.)

cannot use plusClient (variable of type "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/nginx/runtime".NginxPlusClient) as *"github.com/nginxinc/nginx-plus-go-client/client".NginxClient value in argument to nginxCollector.NewNginxPlusCollector: need type assertion) (typecheck)
metrics.Namespace,
nginxCollector.VariableLabelNames{},
constLabels,
Expand Down
6 changes: 3 additions & 3 deletions internal/mode/static/nginx/runtime/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var childProcPathFmt = "/proc/%[1]v/task/%[1]v/children"

//counterfeiter:generate . nginxPlusClient

type nginxPlusClient interface {
type NginxPlusClient interface {
UpdateHTTPServers(
upstream string,
servers []ngxclient.UpstreamServer,
Expand Down Expand Up @@ -79,13 +79,13 @@ type ManagerImpl struct {
processHandler ProcessHandler
metricsCollector MetricsCollector
verifyClient nginxConfigVerifier
ngxPlusClient nginxPlusClient
ngxPlusClient NginxPlusClient
logger logr.Logger
}

// NewManagerImpl creates a new ManagerImpl.
func NewManagerImpl(
ngxPlusClient nginxPlusClient,
ngxPlusClient NginxPlusClient,
collector MetricsCollector,
logger logr.Logger,
processHandler ProcessHandler,
Expand Down
Loading