Skip to content

Commit

Permalink
Fix broken test case (#116)
Browse files Browse the repository at this point in the history
* Fix broken test case & Fix github action checking out development
instead of PR branch

* Switch to v3 checkout and custom ref

* More actions updates
  • Loading branch information
shayaantx authored Dec 20, 2023
1 parent b1d66bc commit 2ab7f24
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/development-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
echo "Building $VERSION"
- name: Build
run: mvn --no-transfer-progress compile
- name: Test
run: mvn --no-transfer-progress test
- name: Package
run: mvn --no-transfer-progress package -DskipTests
- name: Create Github Release
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: pull-request
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- 'development'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup java
uses: actions/setup-java@v1
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ public void format_apiKeyInString_noMaskedText() {
}};
patternConverter.format(mockedEvent, output);
//input should remain unchanged
Assert.assertEquals("http://localhost?apiKey=****", output.toString());
Assert.assertEquals("http://localhost?****", output.toString());
}

@Test
public void format_access_tokenInString_noMaskedText() {
String input = "http://localhost?access_token=fdskjkjfd";
LogEventPatternConverter patternConverter = new Log4jSensitiveDataPattern("test", "style");
StringBuilder output = new StringBuilder();
new Expectations() {{
mockedEvent.getMessage().getFormattedMessage(); result = input;
}};
patternConverter.format(mockedEvent, output);
//input should remain unchanged
Assert.assertEquals("http://localhost?****", output.toString());
}

@Mocked
Expand Down

0 comments on commit 2ab7f24

Please sign in to comment.