[bitnami/solr] Revisit tests (#13667)

Signed-off-by: FraPazGal <fdepaz@vmware.com>

Signed-off-by: FraPazGal <fdepaz@vmware.com>
This commit is contained in:
Francisco de Paz Galan
2022-12-02 09:19:44 +01:00
committed by GitHub
parent 661ee1f173
commit fdb3ea9111
9 changed files with 67 additions and 86 deletions
+9
View File
@@ -0,0 +1,9 @@
{
"username": "admin_user",
"password": "ComplicatedPassword123!4",
"collection": {
"name": "vib-test-collection",
"shards": 2,
"replicas": 2
}
}
+1 -5
View File
@@ -1,8 +1,4 @@
{
"baseUrl": "http://localhost/",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
},
"defaultCommandTimeout": 30000
}
}
@@ -1,37 +1,13 @@
/// <reference types="cypress" />
import { random, getBasicAuthHeader } from '../support/utils';
import { getBasicAuthHeader } from '../support/utils';
it('allows accessing the Dashboard', () => {
it('checks initialized collection', () => {
cy.login();
cy.visit('/solr/#/');
cy.contains('Unauthorized').should('not.exist');
cy.visit(`/solr/#/${Cypress.env('collection').name}/collection-overview`);
cy.contains('solr-spec');
cy.contains('JVM');
cy.contains('solr.install.dir=/opt/bitnami/solr');
});
it('checks all nodes are up', () => {
const NUMBER_OF_NODES = 3;
cy.login();
cy.visit('/solr/#/~cloud');
cy.get('table#nodes-table').within(() => {
cy.get('div[class*="host-name"]').should('have.length', NUMBER_OF_NODES);
});
});
it('allows registering a user', () => {
cy.login();
cy.visit('/solr/#/~security');
cy.fixture('users').then((users) => {
cy.contains('button', 'Add User').click();
cy.get('input#add_user').type(`${users.newUser.username}.${random}`);
cy.get('input#add_user_password').type(users.newUser.password);
cy.get('input#add_user_password2').type(users.newUser.password);
cy.contains('button', 'Add User').click();
cy.contains('td', `${users.newUser.username}.${random}`);
cy.get('#shards').within(() => {
cy.get('[class*="shard-title"]').should('have.length', Cypress.env('collection').shards);
cy.get('[href*="solr-"]').should('have.length', Cypress.env('collection').shards * Cypress.env('collection').replicas);
});
});
@@ -49,7 +25,7 @@ it('allows uploading and indexing a file', () => {
formData.set('user-file', content, 'data.js');
cy.request({
url: '/solr/my-collection/update',
url: `/solr/${Cypress.env('collection').name}/update`,
qs: {
commitWithin: 1000,
overwrite: true,
@@ -69,7 +45,7 @@ it('allows uploading and indexing a file', () => {
// Get an arbitrary book from the collection
var book = $books[Math.floor(Math.random() * $books.length)];
cy.request({
url: '/solr/my-collection/query',
url: `/solr/${Cypress.env('collection').name}/query`,
qs: {
q: `title:${book.title}`,
'q.op': 'OR',
@@ -90,7 +66,7 @@ it('allows uploading and indexing a file', () => {
it('allows retrieving sample schema', () => {
cy.request({
url: '/solr/my-collection/schema',
url: `/solr/${Cypress.env('collection').name}/schema`,
method: 'GET',
headers: {
Authorization: getBasicAuthHeader(),
@@ -21,8 +21,8 @@ Cypress.Commands.add(
});
cy.visit('/solr/#/');
cy.contains('Basic Authentication');
cy.get('input#username').type(username);
cy.get('input#password').type(password);
cy.get('#username').type(username);
cy.get('#password').type(password);
cy.contains('button', 'Login').click();
}
);
@@ -1,7 +1,5 @@
/// <reference types="cypress" />
export let random = (Math.random() + 1).toString(36).substring(7);
export const getBasicAuthHeader = (
username = Cypress.env("username"),
password = Cypress.env("password")
+24 -29
View File
@@ -1,39 +1,34 @@
command:
which-solr:
exec: which solr
{{- $auth := printf "SOLR_AUTH_TYPE=basic SOLR_AUTHENTICATION_OPTS=-Dbasicauth=%s:%s" .Vars.auth.adminUsername .Vars.auth.adminPassword }}
{{- $collection := printf "test.%s" (randNumeric 5) }}
{{- $replicas := .Vars.replicaCount }}
solr-manage-collection:
exec: |
export {{ $auth }} && \
solr create_collection -p {{ .Vars.containerPorts.http }} -replicationFactor {{ $replicas }} -c {{ $collection }} && \
solr healthcheck -z solr-zookeeper:2181/solr -c {{ $collection }}
exit-status: 0
stdout:
- "/opt/bitnami/solr/bin/solr"
stderr: [ ]
timeout: 40000
solr-version-ok:
exec: solr version | grep --quiet "$APP_VERSION"
exit-status: 0
stdout: [ ]
stderr: [ ]
timeout: 40000
solr-assert-running:
exec: SOLR_AUTH_TYPE=basic SOLR_AUTHENTICATION_OPTS="-Dbasicauth=${SOLR_ADMIN_USERNAME}:${SOLR_ADMIN_PASSWORD}" solr assert --cloud "http://localhost:${SOLR_PORT_NUMBER}/solr/"
exit-status: 0
stdout: [ ]
stderr: [ ]
timeout: 40000
solr-create-collection:
exec: SOLR_AUTH_TYPE=basic SOLR_AUTHENTICATION_OPTS="-Dbasicauth=${SOLR_ADMIN_USERNAME}:${SOLR_ADMIN_PASSWORD}" /opt/bitnami/solr/bin/solr create_collection -c "test.${RANDOM}"
- healthy
{{ range $e, $i := until $replicas }}
- /solr-{{ $i }}/
{{ end }}
timeout: 30000
check-user-info:
exec: id
exit-status: 0
stdout:
- "Created collection"
stderr: [ ]
timeout: 40000
- uid={{ .Vars.containerSecurityContext.runAsUser }}
- /groups=.*{{ .Vars.podSecurityContext.fsGroup }}/
file:
/opt/bitnami/solr/server:
{{ .Vars.persistence.mountPath }}:
filetype: directory
exists: true
/opt/bitnami/solr/server/solr/solr.xml:
mode: "0644"
mode: "2775"
owner: root
/scripts/setup.sh:
mode: "0755"
filetype: file
exists: true
/opt/bitnami/solr/server/solr/zoo.cfg:
mode: "0644"
filetype: file
exists: true
contains:
- SOLR_CLOUD_BOOTSTRAP={{ if .Vars.cloudBootstrap }}yes{{ else }}no{{ end }}
+13
View File
@@ -0,0 +1,13 @@
auth:
adminUsername: admin_user
adminPassword: ComplicatedPassword123!4
cloudBootstrap: true
replicaCount: 4
containerPorts:
http: 8984
podSecurityContext:
fsGroup: 1002
containerSecurityContext:
runAsUser: 1002
persistence:
mountPath: /bitnami/solr
+4 -7
View File
@@ -22,7 +22,7 @@
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/solr"
},
"runtime_parameters": "ImF1dGgiOgogICJhZG1pblBhc3N3b3JkIjogIkNvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNCIKICAiYWRtaW5Vc2VybmFtZSI6ICJ1c2VyIgoic2VydmljZSI6CiAgInBvcnRzIjoKICAgICJodHRwIjogODAKICAidHlwZSI6ICJMb2FkQmFsYW5jZXIi",
"runtime_parameters": "YXV0aDoKICBlbmFibGVkOiB0cnVlCiAgYWRtaW5QYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CiAgYWRtaW5Vc2VybmFtZTogYWRtaW5fdXNlcgpjbG91ZEVuYWJsZWQ6IHRydWUKY2xvdWRCb290c3RyYXA6IHRydWUKY29sbGVjdGlvbjogdmliLXRlc3QtY29sbGVjdGlvbgpjb2xsZWN0aW9uU2hhcmRzOiAyCmNvbGxlY3Rpb25SZXBsaWNhczogMgpyZXBsaWNhQ291bnQ6IDQKY29udGFpbmVyUG9ydHM6CiAgaHR0cDogODk4NApwb2RTZWN1cml0eUNvbnRleHQ6CiAgZW5hYmxlZDogdHJ1ZQogIGZzR3JvdXA6IDEwMDIKY29udGFpbmVyU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBydW5Bc1VzZXI6IDEwMDIKc2VydmljZToKICBwb3J0czoKICAgIGh0dHA6IDgwCiAgdHlwZTogTG9hZEJhbGFuY2VyCnBlcnNpc3RlbmNlOgogIGVuYWJsZWQ6IHRydWUKICBtb3VudFBhdGg6IC9iaXRuYW1pL3NvbHIKem9va2VlcGVyOgogIGVuYWJsZWQ6IHRydWU=",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
@@ -46,7 +46,8 @@
},
"remote": {
"workload": "sts-solr"
}
},
"vars_file": "vars.yaml"
}
},
{
@@ -56,11 +57,7 @@
"path": "/.vib/solr/cypress"
},
"endpoint": "lb-solr-tcp-client",
"app_protocol": "HTTP",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
}
"app_protocol": "HTTP"
}
}
]
+5 -8
View File
@@ -22,11 +22,11 @@
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/solr"
},
"runtime_parameters": "ImF1dGgiOgogICJhZG1pblBhc3N3b3JkIjogIkNvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNCIKICAiYWRtaW5Vc2VybmFtZSI6ICJ1c2VyIgoic2VydmljZSI6CiAgInBvcnRzIjoKICAgICJodHRwIjogODAKICAidHlwZSI6ICJMb2FkQmFsYW5jZXIi",
"runtime_parameters": "YXV0aDoKICBlbmFibGVkOiB0cnVlCiAgYWRtaW5QYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CiAgYWRtaW5Vc2VybmFtZTogYWRtaW5fdXNlcgpjbG91ZEVuYWJsZWQ6IHRydWUKY2xvdWRCb290c3RyYXA6IHRydWUKY29sbGVjdGlvbjogdmliLXRlc3QtY29sbGVjdGlvbgpjb2xsZWN0aW9uU2hhcmRzOiAyCmNvbGxlY3Rpb25SZXBsaWNhczogMgpyZXBsaWNhQ291bnQ6IDQKY29udGFpbmVyUG9ydHM6CiAgaHR0cDogODk4NApwb2RTZWN1cml0eUNvbnRleHQ6CiAgZW5hYmxlZDogdHJ1ZQogIGZzR3JvdXA6IDEwMDIKY29udGFpbmVyU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBydW5Bc1VzZXI6IDEwMDIKc2VydmljZToKICBwb3J0czoKICAgIGh0dHA6IDgwCiAgdHlwZTogTG9hZEJhbGFuY2VyCnBlcnNpc3RlbmNlOgogIGVuYWJsZWQ6IHRydWUKICBtb3VudFBhdGg6IC9iaXRuYW1pL3NvbHIKem9va2VlcGVyOgogIGVuYWJsZWQ6IHRydWU=",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
"name": "M4"
}
}
},
@@ -46,7 +46,8 @@
},
"remote": {
"workload": "sts-solr"
}
},
"vars_file": "vars.yaml"
}
},
{
@@ -56,11 +57,7 @@
"path": "/.vib/solr/cypress"
},
"endpoint": "lb-solr-tcp-client",
"app_protocol": "HTTP",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
}
"app_protocol": "HTTP"
}
}
]