Skip to content
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

Move jira-issue-lottery.config-file-repo value from application.properties to .env file and set a default for testing. #66

Merged
merged 1 commit into from
Feb 29, 2024
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
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,20 @@ Fork this repository to your GitHub account.
+ Integer, mandatory, no default.



2. Commit and push the changes to your forked repository.

### Configure Application Properties
1. Change the value of `jira-issue-lottery.config-file-repo` in the `application.properties` file to point to a public repository with a valid config file according to first step in [Configuration section](#configure-jira-lottery) such as `https://github.com/jboss-set/jira-issue-lottery`.

### Create .env File
1. Create a `.env` file in the main directory of your app.
2. Create a Jira Personal Access Token ([Guide on how to create the token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html))
3. Add the following variable to the `.env` file:
2. Add the value of `%DEV_JIRA_ISSUE_LOTTERY_CONFIG_FILE_REPO` in the `.env` file to point to a public repository with a valid config file according to first step in [Configuration section](#configure-jira-lottery) such as `https://github.com/jboss-set/jira-issue-lottery`.
```env
%DEV_JIRA_ISSUE_LOTTERY_CONFIG_FILE_REPO=<repository url>
> **NOTE** This will override the default value of specified in `application.properties` file. If you override the value for all modes (dev, test, prod, when you don't prepend a mode, such as `%dev`), then one of the tests will fail, as it expects the original value.
3. Create a Jira Personal Access Token ([Guide on how to create the token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html))
4. Add the following variable to the `.env` file:
```env
jira-issue-lottery.access-token=<YOUR TOKEN>
JIRA_ISSUE_LOTTERY_ACCESS_TOKEN=<jira token>
QUARKUS_MAILER_FROM=<email address>
QUARKUS_MAILER_USERNAME=<email address>
QUARKUS_MAILER_PASSWORD=<email password>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
camel.component.jira.jira-url=https://issues.redhat.com/
%test.jira-issue-lottery.access-token=ignored
jira-issue-lottery.config-file-repo=https://github.com/The-Huginn/jira-issue-lottery
jira-issue-lottery.max-results=1000
jira-issue-lottery.config-file-repo=https://github.com/jboss-set/jira-issue-lottery
quarkus.kubernetes.deployment-kind=cron-job
# Cron expression to run the job every Monday see https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#writing-a-cronjob-spec
quarkus.kubernetes.cron-job.schedule=0 0 * * 1
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/org/jboss/set/draw/LotteryDrawingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ public void testAppendingRepositoryForUnsubcription() throws Exception {

List<Mail> sent = mailbox.getMailsSentTo(email);
assertEquals(1, sent.size());
// Check directly for this URL as we know it is valid one. Using templates might result in a corrupted URL overall
assertTrue(sent.get(0).getText()
.contains("https://github.com/The-Huginn/jira-issue-lottery/blob/main/.github/jira-issue-lottery.yml"));
String emailText = sent.get(0).getText();

//Checks only if email message is correctly formatted. The URL is only for test purpose and may be invalid.
String expectedUrl = "https://github.com/jboss-set/jira-issue-lottery/blob/main/.github/jira-issue-lottery.yml";
assertTrue(emailText.contains(expectedUrl));
}

@Test
Expand Down
Loading