Skip to content

add test cases #12

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

Merged
merged 1 commit into from
Jan 21, 2019
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
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Topcoder - Community Processor
# Topcoder - Community Processor

## Dependencies

Expand All @@ -19,6 +19,7 @@ The following parameters can be set in config files or in env variables:
- KAFKA_CLIENT_CERT_KEY: Kafka connection private key, optional; default value is undefined;
if not provided, then SSL connection is not used, direct insecure connection is used;
if provided, it can be either path to private key file or private key content
- KAFKA_GROUP_ID: Kafka group id, default value is 'tc-member-group-processor-group'
- KAFKA_TOPICS: Kafka topics to listen, default value is ['member.action.profile.trait.create', 'member.action.profile.trait.update', 'member.action.profile.trait.delete']
- TC_API_BASE_URL: TC API base URL, default value is 'https://api.topcoder.com'
- AUTH0_URL: Auth0 URL, used to get TC M2M token
Expand All @@ -32,6 +33,12 @@ export AUTH0_URL="<Auth0 URL>"
export AUTH0_CLIENT_ID="<Auth0 Client ID>"
export AUTH0_CLIENT_SECRET="<Auth0 Client Secret>"

Configuration for test is at config/test.js:

- MOCK_M2M_API_PORT: the port of mock M2M api, default value: 4000
- MOCK_GROUP_API_PORT: the port of mock group api, default value: 4001
- WAIT_TIME: wait time used in test, default is 1500 or 1.5 second

## Local Kafka setup

- `http://kafka.apache.org/quickstart` contains details to setup and manage Kafka server,
Expand Down Expand Up @@ -108,6 +115,10 @@ docker-compose up
]
},
"createdBy": 23225544,
- "updatedAt": "8/15/18 6:22 PM"
"updatedAt": "8/15/18 6:22 PM"
}
```
```

## Testing
- Run `npm run test` to execute unit tests.
- RUN `npm run e2e` to execute e2e tests.
2 changes: 2 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module.exports = {
KAFKA_CLIENT_CERT: process.env.KAFKA_CLIENT_CERT,
KAFKA_CLIENT_CERT_KEY: process.env.KAFKA_CLIENT_CERT_KEY,

KAFKA_GROUP_ID: process.env.KAFKA_GROUP_ID || 'tc-member-group-processor-group',

KAFKA_TOPICS: (process.env.KAFKA_TOPICS && process.env.KAFKA_TOPICS.split(',')) ||
['member.action.profile.trait.create', 'member.action.profile.trait.update', 'member.action.profile.trait.delete'],

Expand Down
19 changes: 19 additions & 0 deletions config/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* The test configuration.
*/
const MOCK_M2M_API_PORT = 4000
const MOCK_GROUP_API_PORT = 4001

module.exports = {
LOG_LEVEL: 'debug',
MOCK_M2M_API_PORT,
MOCK_GROUP_API_PORT,
// The M2M API URL
TC_API_BASE_URL: `http://localhost:${MOCK_GROUP_API_PORT}`,
// configuration for TC M2M API
AUTH0_URL: `http://localhost:${MOCK_M2M_API_PORT}/m2m`,
AUTH0_AUDIENCE: 'https://www.topcoder.com',
AUTH0_CLIENT_ID: 'test_id',
AUTH0_CLIENT_SECRET: 'test_secret',
WAIT_TIME: 1500
}
Loading