Skip to content

Commit cb31f7d

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/node-selector
2 parents 2f4f4d8 + 38dcb31 commit cb31f7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2217
-273
lines changed

Jenkinsfile.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,16 @@ def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
8181
return {
8282
timestamps {
8383
timeout(time: myParams.LONG ? 180 : 30) {
84-
withCredentials([string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE')]) {
84+
withCredentials([
85+
string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE'),
86+
string(credentialsId: 'ENTERPRISELICENSE', variable: 'DEFAULTENTERPRISELICENSE'),
87+
]) {
8588
withEnv([
8689
"CLEANDEPLOYMENTS=1",
8790
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
8891
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
8992
"ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
93+
"ENTERPRISELICENSE=${myParams.ENTERPRISELICENSE}",
9094
"ARANGODIMAGE=${myParams.ARANGODIMAGE}",
9195
"IMAGETAG=jenkins-test",
9296
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
@@ -132,6 +136,7 @@ pipeline {
132136
string(name: 'TESTNAMESPACE', defaultValue: 'jenkins', description: 'TESTNAMESPACE sets the kubernetes namespace to ru tests in (this must be short!!)', )
133137
string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests', )
134138
string(name: 'ARANGODIMAGE', defaultValue: '', description: 'ARANGODIMAGE sets the docker image used for tests (except enterprise and update tests)', )
139+
string(name: 'ENTERPRISELICENSE', defaultValue: '', description: 'ENTERPRISELICENSE sets the enterprise license key for enterprise tests', )
135140
string(name: 'TESTOPTIONS', defaultValue: '', description: 'TESTOPTIONS is used to pass additional test options to the integration test', )
136141
}
137142
stages {

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ endif
7373
ifndef ENTERPRISEIMAGE
7474
ENTERPRISEIMAGE := $(DEFAULTENTERPRISEIMAGE)
7575
endif
76+
ifndef ENTERPRISELICENSE
77+
ENTERPRISELICENSE := $(DEFAULTENTERPRISELICENSE)
78+
endif
7679
DASHBOARDBUILDIMAGE := kube-arangodb-dashboard-builder
7780

7881
ifndef ALLOWCHAOS
@@ -307,7 +310,8 @@ endif
307310
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
308311
kubectl apply -f $(MANIFESTPATHTEST)
309312
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
310-
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ARANGODIMAGE)" "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
313+
$(ROOTDIR)/scripts/kube_create_license_key_secret.sh "$(DEPLOYMENTNAMESPACE)" '$(ENTERPRISELICENSE)'
314+
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ARANGODIMAGE)" '$(ENTERPRISEIMAGE)' $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
311315

312316
$(DURATIONTESTBIN): $(GOBUILDDIR) $(SOURCES)
313317
@mkdir -p $(BINDIR)

dashboard/assets.go

Lines changed: 66 additions & 66 deletions
Large diffs are not rendered by default.

deps/github.com/arangodb/go-driver/.envrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

deps/github.com/arangodb/go-driver/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/github.com/arangodb/go-driver/.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

deps/github.com/arangodb/go-driver/.vscode/settings.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

deps/github.com/arangodb/go-driver/client.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ type Client interface {
4040
// This function requires ArangoDB 3.1.15 or up.
4141
SynchronizeEndpoints(ctx context.Context) error
4242

43+
// SynchronizeEndpoints2 fetches all endpoints from an ArangoDB cluster and updates the
44+
// connection to use those endpoints.
45+
// When this client is connected to a single server, nothing happens.
46+
// When this client is connected to a cluster of servers, the connection will be updated to reflect
47+
// the layout of the cluster.
48+
// Compared to SynchronizeEndpoints, this function expects a database name as additional parameter.
49+
// This database name is used to call `_db/<dbname>/_api/cluster/endpoints`. SynchronizeEndpoints uses
50+
// the default database, i.e. `_system`. In the case the user does not have access to `_system`,
51+
// SynchronizeEndpoints does not work with earlier versions of arangodb.
52+
SynchronizeEndpoints2(ctx context.Context, dbname string) error
53+
4354
// Connection returns the connection used by this client
4455
Connection() Connection
4556

deps/github.com/arangodb/go-driver/client_impl.go

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package driver
2424

2525
import (
2626
"context"
27+
"path"
2728
"time"
2829

2930
"github.com/arangodb/go-driver/util"
@@ -67,19 +68,28 @@ func (c *client) Connection() Connection {
6768
// When this client is connected to a cluster of servers, the connection will be updated to reflect
6869
// the layout of the cluster.
6970
func (c *client) SynchronizeEndpoints(ctx context.Context) error {
70-
role, err := c.ServerRole(ctx)
71-
if err != nil {
72-
return WithStack(err)
73-
}
74-
if role == ServerRoleSingle {
75-
// Standalone server, do nothing
76-
return nil
77-
}
71+
return c.SynchronizeEndpoints2(ctx, "")
72+
}
7873

74+
// SynchronizeEndpoints2 fetches all endpoints from an ArangoDB cluster and updates the
75+
// connection to use those endpoints.
76+
// When this client is connected to a single server, nothing happens.
77+
// When this client is connected to a cluster of servers, the connection will be updated to reflect
78+
// the layout of the cluster.
79+
// Compared to SynchronizeEndpoints, this function expects a database name as additional parameter.
80+
// This database name is used to call `_db/<dbname>/_api/cluster/endpoints`. SynchronizeEndpoints uses
81+
// the default database, i.e. `_system`. In the case the user does not have access to `_system`,
82+
// SynchronizeEndpoints does not work with earlier versions of arangodb.
83+
func (c *client) SynchronizeEndpoints2(ctx context.Context, dbname string) error {
7984
// Cluster mode, fetch endpoints
80-
cep, err := c.clusterEndpoints(ctx)
85+
cep, err := c.clusterEndpoints(ctx, dbname)
8186
if err != nil {
82-
return WithStack(err)
87+
// ignore Forbidden: automatic failover is not enabled errors
88+
if !IsArangoErrorWithErrorNum(err, 403, 0, 11) { // 3.2 returns no error code, thus check for 0
89+
return WithStack(err)
90+
}
91+
92+
return nil
8393
}
8494
var endpoints []string
8595
for _, ep := range cep.Endpoints {
@@ -114,8 +124,14 @@ type clusterEndpoint struct {
114124
}
115125

116126
// clusterEndpoints returns the endpoints of a cluster.
117-
func (c *client) clusterEndpoints(ctx context.Context) (clusterEndpointsResponse, error) {
118-
req, err := c.conn.NewRequest("GET", "_api/cluster/endpoints")
127+
func (c *client) clusterEndpoints(ctx context.Context, dbname string) (clusterEndpointsResponse, error) {
128+
var url string
129+
if dbname == "" {
130+
url = "_api/cluster/endpoints"
131+
} else {
132+
url = path.Join("_db", pathEscape(dbname), "_api/cluster/endpoints")
133+
}
134+
req, err := c.conn.NewRequest("GET", url)
119135
if err != nil {
120136
return clusterEndpointsResponse{}, WithStack(err)
121137
}

deps/github.com/arangodb/go-driver/cluster.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ type ServerHealth struct {
7575
Status ServerStatus `json:"Status"`
7676
CanBeDeleted bool `json:"CanBeDeleted"`
7777
HostID string `json:"Host,omitempty"`
78+
Version Version `json:"Version,omitempty"`
79+
Engine EngineType `json:"Engine,omitempty"`
7880
}
7981

8082
// ServerStatus describes the health status of a server
@@ -93,6 +95,8 @@ const (
9395
type DatabaseInventory struct {
9496
// Details of all collections
9597
Collections []InventoryCollection `json:"collections,omitempty"`
98+
// Details of all views
99+
Views []InventoryView `json:"views,omitempty"`
96100
}
97101

98102
// IsReady returns true if the IsReady flag of all collections is set.
@@ -124,6 +128,17 @@ func (i DatabaseInventory) CollectionByName(name string) (InventoryCollection, b
124128
return InventoryCollection{}, false
125129
}
126130

131+
// ViewByName returns the InventoryView with given name.
132+
// Return false if not found.
133+
func (i DatabaseInventory) ViewByName(name string) (InventoryView, bool) {
134+
for _, v := range i.Views {
135+
if v.Name == name {
136+
return v, true
137+
}
138+
}
139+
return InventoryView{}, false
140+
}
141+
127142
// InventoryCollection is a single element of a DatabaseInventory, containing all information
128143
// of a specific collection.
129144
type InventoryCollection struct {
@@ -196,6 +211,19 @@ func (i InventoryIndex) FieldsEqual(fields []string) bool {
196211
return stringSliceEqualsIgnoreOrder(i.Fields, fields)
197212
}
198213

214+
// InventoryView is a single element of a DatabaseInventory, containing all information
215+
// of a specific view.
216+
type InventoryView struct {
217+
Name string `json:"name,omitempty"`
218+
Deleted bool `json:"deleted,omitempty"`
219+
ID string `json:"id,omitempty"`
220+
IsSystem bool `json:"isSystem,omitempty"`
221+
PlanID string `json:"planId,omitempty"`
222+
Type ViewType `json:"type,omitempty"`
223+
// Include all properties from an arangosearch view.
224+
ArangoSearchViewProperties
225+
}
226+
199227
// stringSliceEqualsIgnoreOrder returns true when the given lists contain the same elements.
200228
// The order of elements is irrelevant.
201229
func stringSliceEqualsIgnoreOrder(a, b []string) bool {

0 commit comments

Comments
 (0)