Skip to content

Update NGINX Plus in Integration Tests #1212

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

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 5 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ permissions:
env:
NFPM_VERSION: 'v2.35.3'
GOPROXY: "direct"
NGINX_LICENSE_JWT: ${{ secrets.NGINX_LICENSE_JWT }}

jobs:
proxy-sanity-check:
Expand Down Expand Up @@ -179,6 +180,7 @@ jobs:
CONTAINER_NGINX_IMAGE_REGISTRY="docker-registry.nginx.com" \
TAG="${{ matrix.container.version }}-${{ matrix.container.image }}" \
OS_RELEASE="${{ matrix.container.release }}" OS_VERSION="${{ matrix.container.version }}" \
NGINX_LICENSE_JWT="${{ secrets.NGINX_LICENSE_JWT }}" \
make official-image-integration-test

official-plus-image-integration-tests:
Expand All @@ -190,25 +192,10 @@ jobs:
matrix:
container:
- image: "alpine"
version: "3.20"
plus: "r32"
version: "3.21"
plus: "r34"
release: "alpine"
path: "/nginx-plus/agent"
- image: "alpine"
version: "3.19"
plus: "r31"
release: "alpine"
path: "/nginx-plus/agent"
- image: "debian"
version: "bookworm"
plus: "r32"
release: "debian"
path: "/nginx-plus/agent"
- image: "debian"
version: "bookworm"
plus: "r31"
release: "debian"
path: "/nginx-plus/agent"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
Expand All @@ -232,6 +219,7 @@ jobs:
CONTAINER_NGINX_IMAGE_REGISTRY="${{ secrets.REGISTRY_URL }}" \
TAG="${{ matrix.container.plus }}-${{ matrix.container.image }}-${{ matrix.container.version }}" \
OS_RELEASE="${{ matrix.container.release }}" OS_VERSION="${{ matrix.container.version }}" IMAGE_PATH="${{ matrix.container.path }}" \
NGINX_LICENSE_JWT="${{ secrets.NGINX_LICENSE_JWT }}" \
make official-image-integration-test

performance-tests:
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ DOCKERFILE_PATH = "./test/docker/nginx-oss/$(CONTAINER_OS_TYPE)/Dockerfile"
OFFICIAL_IMAGE_DOCKERFILE_PATH = "./test/docker/nginx-official-image/$(CONTAINER_OS_TYPE)/Dockerfile"
IMAGE_PATH ?= "/nginx/agent"
TAG ?= ""
NGINX_LICENSE_JWT ?= ""

BUILD_DIR := build
TEST_BUILD_DIR := build/test
Expand Down Expand Up @@ -169,6 +170,7 @@ official-image-integration-test: $(SELECTED_PACKAGE) build-mock-management-plane
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} BUILD_TARGET="install" \
PACKAGES_REPO=$(OSS_PACKAGES_REPO) TAG=${TAG} PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) DOCKERFILE_PATH=$(OFFICIAL_IMAGE_DOCKERFILE_PATH) \
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) IMAGE_PATH=$(IMAGE_PATH) \
NGINX_LICENSE_JWT=$(NGINX_LICENSE_JWT) \
go test -v ./test/integration/managementplane ./test/integration/auxiliarycommandserver

performance-test:
Expand Down
2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/command.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/files.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions test/helpers/test_containers_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package helpers
import (
"context"
"io"
"os"
"path/filepath"
"testing"

"github.com/docker/docker/api/types"
Expand Down Expand Up @@ -86,6 +88,11 @@ func StartContainer(
ContainerFilePath: "/etc/nginx/nginx.conf",
FileMode: configFilePermissions,
},
{
HostFilePath: filepath.Join(os.TempDir(), "license.jwt"),
ContainerFilePath: "/etc/nginx/license.jwt",
FileMode: configFilePermissions,
},
},
}

Expand Down
16 changes: 16 additions & 0 deletions test/integration/utils/grpc_management_plane_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net"
"net/http"
"os"
"path/filepath"
"slices"
"sort"
"testing"
Expand Down Expand Up @@ -175,6 +176,21 @@ func setupNginxContainer(
if os.Getenv("IMAGE_PATH") == "/nginx-plus/agent" {
nginxConfPath = "../../config/nginx/nginx-plus.conf"
}
if os.Getenv("NGINX_LICENSE_JWT") != "" {
tb.Log("Using NGINX license JWT from environment variable")
tb.Logf("jwt contents: %s", os.Getenv("NGINX_LICENSE_JWT"))
licensePath := filepath.Join(os.TempDir(), "license.jwt")
license, err := os.Create(licensePath)
if err != nil {
tb.Fatalf("Failed to create license file: %v", err)
}
defer license.Close()

_, err = license.WriteString((os.Getenv("NGINX_LICENSE")))
if err != nil {
tb.Fatalf("Failed to write license to file: %v", err)
}
}
params.NginxConfigPath = nginxConfPath

Container = helpers.StartContainer(ctx, tb, containerNetwork, params)
Expand Down
Loading