This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import logging | |
from google.cloud import aiplatform | |
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s: %(message)s") | |
logger = logging.getLogger(__name__) | |
model_id = sys.argv[1] | |
artifact_uri = sys.argv[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"IamFleetRole": "arn:aws:iam::<aws-account-id>:role/<fleet-role-name>", | |
"AllocationStrategy": "lowestPrice", | |
"TargetCapacity": 2, | |
"SpotPrice": "0.105", | |
"ValidUntil": "2050-01-01T00:00:00Z", | |
"TerminateInstancesWithExpiration": false, | |
"LaunchSpecifications": [ | |
{ | |
"ImageId": "<ami-id-for-your-region>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"family": "hello-world-task-def", | |
"containerDefinitions": [ | |
{ | |
"name": "hello-world", | |
"image": "<aws-account-id>.dkr.ecr.us-east-1.amazonaws.com/hello-world", | |
"memoryReservation": 1024, | |
"command": ["python", "/home/ubuntu/workspace/keras-docker-hello-world/hello_world.py"] | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should change the text on click', async () => { | |
http.get.mockImplementation(() => Promise.resolve({ body: 'the-return-of-my-get-request' })); | |
const sut = mount( | |
<Provider store={store}> | |
<MyComponent /> | |
</Provider> | |
); | |
sut.find('div').simulate('click'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Async function that will finish execution after all promises have been finished | |
* Usage: | |
* it('...', async () =. { | |
* // mount component | |
* // execute actions | |
* await flushAllPromises(); | |
* // execute assertions for async actions | |
* }); | |
*/ | |
export function flushAllPromises() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to mock a whole imported dependency, do this | |
jest.mock('my-http-client'); | |
import http from 'my-http-client'; | |
// ... | |
it('should change the text on click', () => { | |
http.get.mockImplementation({ body: 'the-return-of-my-get-request' }); | |
const sut = mount( | |
<Provider store={store}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To test if the action producer has dispatched the correct action | |
expect(dispatchSpy).toBeCalledWith({ type: 'DIV_HAS_BEEN_CLICKED' }); | |
// To test if the actual data on the reducer has changed | |
expect(store.getState().myReducer.divText).toEqual('new text'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should change the text on click', () => { | |
const sut = mount( | |
<Provider store={store}> | |
<MyComponent /> | |
</Provider> | |
); | |
sut.find('div').simulate('click'); | |
expect(sut.find('div').prop('children')).toEqual('new text'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('integration tests', () => { | |
let store; | |
let dispatchSpy; | |
let router; | |
beforeEach(() => { | |
router = { | |
params: { myParam: 'any-params-you-have' }, | |
}; | |
({ store, dispatchSpy } = setupIntegrationTest({ myReducer }, router)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { applyMiddleware, combineReducers, createStore } from 'redux'; | |
import thunk from 'redux-thunk'; | |
import { routerStateReducer } from 'redux-router'; | |
/* Sets up basic variables to be used by integration tests | |
* Params: | |
* reducers: should be an object with all the reducers your page uses | |
* initialRouterState: an optional object to set as the initial state for the router | |
* Returns: |
NewerOlder