Skip to content

Commit

Permalink
Support for storing credentials in MongoDB (#4718)
Browse files Browse the repository at this point in the history
* Configure non-field errors for NodeBalancers (#4672)

* Configure non-field errors for NodeBalancers

* Fix scrolling into an error

* M3-OBJ-56 Change: Create Buckets (#4706)

* bucket drawer in redux

* clusters in redux

* create bucket methods and functionality

* make bucketDrawer its own container

* clean

* add tests

* remove success toast

* do not remove any attributes (#4707)

* Support for storing credentials in MongoDB

* Adds CredStore support for cleaning up after tests

* Cleans up clean up code and fixes initialization for mongo

* Tweaks for mongo cleanup code.

Better differentiates between failure deleting resources via API vs
failure cleaning up mongo.

* refactors code that cleans up when all tests finish.

* Fixes cleanup for users and oauth clients

* Updates variable assignments to use constants per feedback from Pat

* Refactors to remove un-needed Promise wrappers and uses async fs methods for FSCredStore

* Add mongo service

* updates functions that read the logged in user's access token in config-utils

* using FSCredStore to compare to MongoCredStore running on baker

* Add event types and account events messages (#4692)

* fix nb create crashing (#4683)

* M3-2568 add missing typography for crash message

* M3-2565 Change in_progress event polling interval back to 1s (#4691)

* M3-2570 Fix: Only disable Linode Boot if there are no configs (#4696)

* use linode's configs instead of image to determine "Power On" visibility

* fix loading icon placement and styling

* remove if found logic (#4700)

* Test Maintenance (#4699)

* StackScripts e2e test maintenance (#4698)

* Fix PAT Token Test (#4697)

* first commit

* Refactor, jsClick action menu if fails to standard click

* unskip desk

* refresh upon deleting token

* add data-qa to backdrop

* change jasmine timeout back to 10

* Rebuild E2E Test Maintenance  (#4695)

* rebuild test fixes

* respond to feeback

* Fix Volumes and Domains tests (#4694)

* Fix Volumes and Domains tests

* fix volumes tags test

* Increase wait time when attaching a volume to wait.long

* M3-2569-timezone-tests fix test

* fix remove linode test (#4702)

* update toast message (#4701)

* v0.51.0

* Update CHANGELOG.md

* read IS_OBJECT_STORAGE_ENABLED as a string

* v0.51.1

* fix lish route (#4736)

* v0.51.2

* update changelog

* M3-OBJ Update Object Storage CTA (#4716)

* update CTA to include bucket creation

* improve cluster select form

* M3-2578 Fix config updating bug (#4712)

* M3-2578 Fix config updating bug

This turned out to be two separate issues.

1. Our createDevicesFromStrings utility was returning "none_id: null" for
the disk ID instead of null as it should have been.
2. There is a small API bug where POST requests for creating a config were not
validated, whereas PUT requests were. This results in a state where it is possible
to create a config that then can't be updated with its initial values.

Fixed #1 by adding a === 'none' check in createDevicesFromStrings, added
temporary client-side validation for #2.

* Add test case for devices set to None

* Update copy

* Feature/cloud apps (#4590)

* add CA create Linode skeleton (#4577)

* CA-XXX Add Distros tab (#4579)

* Working prototype

* Just refactor FIC after all

* add subtabs (#4581)

* CA: Add my images tab (#4582)

* Refactor clone from linode tab to new structure

* Add CASelectStackScriptPanel

* lift state up and fix fromimagecontent

* fix linode clone view

* fix bug

* destructure unnecessary props

* Working mostly

* Remove console log

* use container form state in createfromstackscript

* Add Cloudapps icons to src/assets (#4587)

* fix tabs render bug (#4592)

* Reset creation state on tab change (#4595)

* add error state to creation flow (#4596)

* CA: Move SSH HOC to container (#4597)

* Move SSH key HOC to container

* Reset selected SSH keys correctly

* CLAPPS - Tab State in Redux (#4598)

* set create flow type in redux state

* do it better this time

* bad spelling

* CLAPPS: Add Images subtab (#4599)

* WIP

* WIP 2

* Fix styling

* Fix StackScripts to use new SelectImagePanel

* Fix tab labels

* Add empty state for private images

* Review feedback

- Combine renderPublicImages and renderOlderPublicImages into a single function
- Use <span> instead of <Typography> for placeholder message
- Only pass needed props to FromImageContent

* Pass fewer props to other FromImagesContent instance

* Clean up post-rebase

* CLAPPS - fix dynamic label (#4601)

* fix dynamic label logic

* fix logic

* address feedback

* CLAPPS Add create from backups tab (#4603)

* WIP

* Everything working except errors

* Functional

* Trim unused props

* Fix backup client-side validatioN

* Review feedback

* Utilities has 3 i's

* Use dynamic value for isMakingRequest in FromBackupsContent

* CA-606 Nested Tab Panel Updates (#4586)

* adding paper to the inner tabvs to match pattern as existing panels

* fixing imports

* removing redundant classes that were messing up grid alignment

* fixing broken sidebar

* updating backups tab ordering

* CLAPPS: Add Community StackScripts panel (#4612)

* Add Community StackScripts panel

* Review feedback -- adjust styling

* CLAPPS - Create from App (#4604)

* init commit

* cleanup

* init createapppanel

* add apps panel

* update label logic

* move apps request to container

* reset errors on new stackscript selection

* fix placement of closing grid tag

* fix rebase issues

* CLAPPS Map UDF error fields (#4619)

* Map UDF errors to the correct field

* Fix Notice spacing for select and multiselect UDFs

* Apps UI Edits (#4611)

* adding errors to linodeContent panel instead of component

* fixing gaping issue

* removing sticky stuff from checkout component, adding sticky css

* adding more vertical spacing for larger screensizes

* adding conditional based on image variant public vs private

* style adjustments for apps content

* cleanup from moving notices

* CLAPPS: Fix StackScript routing (#4625)

* Fix typing

* Fix routing (was reloading full site)

* Review feedback

* M3-2512 Move Apps Logos (#4633)

* move images into public dir

* remove logos from src dir

* M3 clapps icons (#4644)

* Add hard-coded icons

* Adapt for Linode account request

* Format Clapps names for display

* Clean up 2

* Review feedback

- Add APP_ROOT constant to icon URL

* Remove duplicate URL slash

* Apps UDF Improvements (#4629)

* putting optional fields into collapsible container

* actually filtering properly now

* some styling edits

* removing test styles

* applying grid to optional form UDFs

* applying max width

* removing grid from individual udf fields

* improving form grids for other input types, adding prop for password input to hide strength span

* fix keys errors and remove inconsistent margins

* adding key to grid items

* making optional fields open by default if no required fields, adjustments to other components using showMoreExpansion component

* addressing PR feedback

* additional updates

* leverage one-click-apps endpoint (#4659)

* pass down stackscript id (#4668)

* Update Rust icon (#4671)

* M3 Fix clapps advanced option bug (#4669)

* Update cDU logic

Added a check to cDU so that if the default value of defaultOpen (on ExpansionPanel) changed,
the view would update, but would not update if the value was re-computed to be the same as
the current value.

Fixes a bug where if the user typed in the Advanced Options fields, the panel would close.

* Fix bug

* CLAPPS: Add defaultImage logic (#4674)

* Add defaultImage logic

* Remove additional is-this-an-app? logic

* Cloud Apps - Bug Fixes (#4677)

* bug fixes

* Copy fixes

* adding missing class to empty linodes to clone container (#4688)

* appease tests and correct types

* fix some more typings

* fix paginated select linode panel

* un-skip tests

* cleanup tests

* remove capuk helper

* fix RenderGuard issues

* fix typography issues on create from image

* defaulting expansion panel for optional udfs to be open

* Rename files to remove CA convention (#4714)

* Remove creation type from auto-generated label (#4715)

* [Cloud Apps] Unit Testing (#4708)

* add unit tests

* typo

* destructure props (#4713)

* One-click app feedback (#4720)

* Review feedback part 1

- Fixed shadowed variable name images in PublicImages.tsx
- Re-added Alpine to PublicImages.tsx
- Update error message to use new One-Click Apps branding

* Fix routing when deploying from a backup

* [Cloud Apps] - StackScript Updates (#4709)

* refactor stackscript logic

* update get account stackscripts to get current user

* fixes

* Fix spelling

* add util function for unauthed errors

* remove tab handling from selectstackscriptpanel (#4721)

* refactor smoke test (#4728)

* M3-2579 add loading states to tag panel

* OCA: fix image routing (#4727)

* Update routing for creating from image

* Set search directly in location

* Error handling and styling

* add front end validation for tag input error

* cleanup

* address feddback

* Merge pull request #4717 from alioso/M3-2579

M3-2579 Improve TagPanel workflow

* M3-2593: fix restore process finished event handling (#4740)

* Control which cred store gets used by setting MONGO_HOST env var

* Add Mongo host env var

* Fix ternary

* Actually fix ternary

* rename mongo_host to CRED_STORE_MODE and refactor ternary again
  • Loading branch information
benschmaus authored and patthiel committed Apr 1, 2019
1 parent ced6359 commit 0156ed7
Show file tree
Hide file tree
Showing 12 changed files with 793 additions and 352 deletions.
4 changes: 4 additions & 0 deletions ci-environment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- selenium
manager-e2e:
environment:
- CRED_STORE_MODE=${CRED_STORE_MODE}
- DOCKER=true
- REACT_APP_APP_ROOT=${REACT_APP_APP_ROOT}
- REACT_APP_API_ROOT=${REACT_APP_API_ROOT}
Expand All @@ -32,3 +33,6 @@ services:
entrypoint: ["./scripts/wait-for-it.sh", "-t", "250", "-s", "selenium:4444", "--", "yarn","e2e", "--log"]
depends_on:
- chrome
- mongodb
mongodb:
image: mongo:latest
4 changes: 2 additions & 2 deletions e2e/config/custom-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const {
loadImposter,
} = require('../utils/mb-utils');

const { readToken } = require('../utils/config-utils');
const { getToken } = require('../utils/config-utils');

exports.browserCommands = () => {
/* Overwrite the native getText function
Expand Down Expand Up @@ -73,7 +73,7 @@ exports.browserCommands = () => {
});

browser.addCommand('readToken', function(username) {
const token = readToken(username);
const token = getToken(username);
return token;
});

Expand Down
3 changes: 3 additions & 0 deletions e2e/config/wdio.axe.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ const { merge } = require('ramda');
const { argv } = require('yargs');
const wdioMaster = require('./wdio.conf.js');
const { browserConf } = require('./browser-config');

// TODO - update to use credstore interface for login instead of config-utils
const {
login
} = require('../utils/config-utils');

const { browserCommands } = require('./custom-commands');

const selectedBrowser = () => {
Expand Down
74 changes: 48 additions & 26 deletions e2e/config/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@ require('dotenv').config();

const { readFileSync, unlinkSync } = require('fs');
const { argv } = require('yargs');
const {
login,
generateCreds,
checkoutCreds,
checkInCreds,
removeCreds,
cleanupAccounts,
} = require('../utils/config-utils');

const { resetAccounts } = require('../setup/cleanup');
const FSCredStore = require('../utils/fs-cred-store');
const MongoCredStore = require('../utils/mongo-cred-store')

const { browserCommands } = require('./custom-commands');
const { browserConf } = require('./browser-config');
const { constants } = require('../constants');
const { keysIn } = require('lodash');
const selectedBrowser = argv.browser ? browserConf[argv.browser] : browserConf['chrome'];

Expand Down Expand Up @@ -51,6 +43,24 @@ const getRunnerCount = () => {
}

const parallelRunners = getRunnerCount();
console.log("parallel runners: " + parallelRunners);

// NOTE: credStore provides a promise-based API. In order to work correctly with WDIO, any calls in
// lifecycle methods *other than* onPrepare and onComplete should be wrapped using WDIO's browser.call
// method. This blocks execution until any promises within the function passed to call are resolved.
// See more at:
// https://webdriver.io/docs/api/browser/call.html
//
// to use mongo cred store, set MONGO_HOST to either localhost (e.g., for local testing) or mongodb (for docker)
// if it's not set the filesystem cred store will be used
let MONGO_HOST = false;

if (process.env.MONGO_HOST) {
MONGO_HOST = process.env.MONGO_HOST == 'mongodb' ? 'mongodb' : false
}

console.log("mongo host set to: " + MONGO_HOST);
const credStore = MONGO_HOST ? new MongoCredStore(MONGO_HOST) : new FSCredStore('./e2e/creds.js');

exports.config = {
// Selenium Host/Port
Expand Down Expand Up @@ -204,6 +214,7 @@ exports.config = {
},

testUser: '', // SET IN THE BEFORE HOOK PRIOR TO EACH TEST

//
// =====
// Hooks
Expand All @@ -218,8 +229,9 @@ exports.config = {
* @param {Array.<Object>} capabilities list of capabilities details
*/
onPrepare: function (config, capabilities, user) {
// Generate our temporary test credentials file
generateCreds('./e2e/creds.js', config, parallelRunners);
console.log("onPrepare");
// Generate temporary test credentials and store for use across tests
credStore.generateCreds(config, parallelRunners);
},
/**
* Gets executed just before initialising the webdriver session and test framework. It allows you
Expand All @@ -237,6 +249,7 @@ exports.config = {
* @param {Array.<String>} specs List of spec file paths that are to be run
*/
before: function (capabilities, specs) {
console.log("before");
// Load up our custom commands
require('@babel/register');

Expand Down Expand Up @@ -264,12 +277,23 @@ exports.config = {
browser.windowHandleMaximize();
}

/* Get test credentials from temporary creds file
Set "inUse:true" for account under test
*/
const testCreds = checkoutCreds('./e2e/creds.js', specs[0]);
// inject browser object into credstore for login and a few other functions
credStore.setBrowser(browser);

// inject credStore into browser so it can be easily accessed from test cases
// and utility code
browser.credStore = credStore;

login(testCreds.username, testCreds.password, './e2e/creds.js');
let creds = null;
browser.call(() => {
return credStore.checkoutCreds(specs[0])
.then((testCreds) => {
creds = testCreds;
}).catch((err) => console.log(err));
});
console.log("creds are");
console.log(creds);
credStore.login(creds.username, creds.password, false);
},
/**
* Runs before a WebdriverIO command gets executed.
Expand Down Expand Up @@ -347,7 +371,9 @@ exports.config = {
}

// Set "inUse:false" on the account under test in the credentials file
checkInCreds('./e2e/creds.js', specs[0]);
browser.call(
() => credStore.checkinCreds(specs[0]).then((creds) => console.log(creds))
);
},
/**
* Gets executed right after terminating the webdriver session.
Expand All @@ -364,13 +390,9 @@ exports.config = {
* @param {Array.<Object>} capabilities list of capabilities details
*/
onComplete: function(exitCode, config, capabilities) {
// Run delete all, on every test account

/* We wait an arbitrary amount of time here for linodes to be removed
Otherwise, attempting to remove attached volumes will fail
*/
return resetAccounts(JSON.parse(readFileSync('./e2e/creds.js')), './e2e/creds.js')
.then(res => resolve(res))
.catch(error => console.error('Error:', error));
console.log("onComplete");
// delete all data created during the test and remove test credentials from
// the underlying store
return credStore.cleanupAccounts();
}
}
Loading

0 comments on commit 0156ed7

Please sign in to comment.