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

fixes sdk calls and 1hr off testing due to daylight savings #1480

Merged
merged 3 commits into from
Oct 30, 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
10 changes: 5 additions & 5 deletions router/xgress_edge/certchecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"crypto/x509"
"crypto/x509/pkix"
"github.com/openziti/channel/v2"
"github.com/openziti/ziti/common/eid"
"github.com/openziti/ziti/router/internal/edgerouter"
"github.com/openziti/ziti/router/env"
"github.com/openziti/foundation/v2/tlz"
"github.com/openziti/foundation/v2/versions"
"github.com/openziti/identity"
"github.com/openziti/transport/v2"
"github.com/openziti/ziti/common/eid"
"github.com/openziti/ziti/router/env"
"github.com/openziti/ziti/router/internal/edgerouter"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
"math/big"
Expand Down Expand Up @@ -50,7 +50,7 @@ func Test_CertExpirationChecker(t *testing.T) {
req := require.New(t)
certChecker, _ := newCertChecker()

now := time.Now()
now := time.Now().UTC()
notAfter := now.AddDate(0, 0, 7)

certChecker.id.Cert().Leaf.NotAfter = notAfter
Expand Down Expand Up @@ -210,7 +210,7 @@ func Test_CertExpirationChecker(t *testing.T) {
req := require.New(t)
certChecker, _ := newCertChecker()

now := time.Now()
now := time.Now().UTC()
notAfter := now.AddDate(0, 0, 7)

certChecker.id.ServerCert()[0].Leaf.NotAfter = notAfter
Expand Down
6 changes: 4 additions & 2 deletions tests/addressable_terminators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package tests

import (
"github.com/openziti/ziti/controller/xt_smartrouting"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/sdk-golang/ziti/edge"
"github.com/openziti/ziti/controller/xt_smartrouting"
"github.com/pkg/errors"
"net"
"strings"
Expand Down Expand Up @@ -142,7 +142,9 @@ func Test_AddressableTerminatorSameIdentity(t *testing.T) {
listener.(edge.SessionListener).SetErrorEventHandler(errorHandler)
defer func() { _ = listener.Close() }()

context2 := ziti.NewContext(identity.config)
context2, err := ziti.NewContext(identity.config)
ctx.Req.NoError(err)

listener2, err := context2.ListenWithOptions(service.Name, &ziti.ListenOptions{
BindUsingEdgeIdentity: true,
ConnectTimeout: 5 * time.Second,
Expand Down
30 changes: 22 additions & 8 deletions tests/data_flow_close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ package tests
import (
"errors"
"fmt"
"github.com/openziti/ziti/common/eid"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/ziti/common/eid"
"io"
"testing"
"time"
Expand Down Expand Up @@ -69,7 +69,9 @@ func Test_ServerConnClosePropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

conn := ctx.WrapConn(clientContext.Dial(service.Name))
defer conn.Close()
Expand Down Expand Up @@ -134,7 +136,9 @@ func Test_ServerContextClosePropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

conn := ctx.WrapConn(clientContext.Dial(service.Name))
defer conn.Close()
Expand Down Expand Up @@ -202,7 +206,9 @@ func Test_ServerCloseListenerPropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

conn := ctx.WrapConn(clientContext.Dial(service.Name))
defer conn.Close()
Expand Down Expand Up @@ -234,7 +240,9 @@ func Test_ClientConnClosePropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

errC := make(chan error, 1)

Expand Down Expand Up @@ -296,7 +304,9 @@ func Test_ClientContextClosePropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

errC := make(chan error, 1)

Expand Down Expand Up @@ -359,7 +369,9 @@ func Test_ServerConnCloseWritePropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

errC := make(chan error, 1)

Expand Down Expand Up @@ -453,7 +465,9 @@ func Test_ClientConnCloseWritePropagation(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

conn := ctx.WrapConn(clientContext.Dial(service.Name))
name := eid.New()
Expand Down
10 changes: 7 additions & 3 deletions tests/data_flow_hs_rotating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ package tests

import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti/ziti/common/eid"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/sdk-golang/ziti/edge"
"github.com/openziti/ziti/common/eid"
"github.com/pkg/errors"
"math/rand"
"sync"
Expand Down Expand Up @@ -122,7 +122,9 @@ func testClientFirstWithStrategy(t *testing.T, strategy string) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

logger := pfxlog.Logger()

Expand Down Expand Up @@ -265,7 +267,9 @@ func testServerFirstWithStrategy(t *testing.T, strategy string) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

ticker := time.NewTicker(time.Millisecond * 500)
defer ticker.Stop()
Expand Down
6 changes: 4 additions & 2 deletions tests/data_flow_hs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ package tests

import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti/ziti/common/eid"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/ziti/common/eid"
"sync/atomic"
"testing"
"time"
Expand Down Expand Up @@ -76,7 +76,9 @@ func Test_HSDataflow(t *testing.T) {

clientIdentity := ctx.AdminManagementSession.RequireNewIdentityWithOtt(false)
clientConfig := ctx.EnrollIdentity(clientIdentity.Id)
clientContext := ziti.NewContext(clientConfig)

clientContext, err := ziti.NewContext(clientConfig)
ctx.Req.NoError(err)

for i := 0; i < 100; i++ {
conn := ctx.WrapConn(clientContext.Dial(service.Name))
Expand Down
Loading