Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Storage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Storage
Commits
b7818266
Commit
b7818266
authored
1 year ago
by
Abhay Joshi
Browse files
Options
Downloads
Patches
Plain Diff
making sure test for special character always run in aws
parent
39c2aa6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!760
Vulnerability fixes
,
!745
Draft: M18 Upgraded packages to mitigate vulns in netty, guava, snakeyaml
,
!744
Upgraded packages to mitigated vulns in netty, guava, snakeyaml
,
!692
M18 service and CICD updates
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testing/storage-test-aws/src/test/java/org/opengroup/osdu/storage/records/TestRecordsApiAcceptance.java
+46
-7
46 additions, 7 deletions
...ngroup/osdu/storage/records/TestRecordsApiAcceptance.java
with
46 additions
and
7 deletions
testing/storage-test-aws/src/test/java/org/opengroup/osdu/storage/records/TestRecordsApiAcceptance.java
+
46
−
7
View file @
b7818266
...
...
@@ -15,12 +15,16 @@
package
org.opengroup.osdu.storage.records
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.opengroup.osdu.storage.util.AWSTestUtils
;
import
org.opengroup.osdu.storage.util.ConfigUtils
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.*
;
import
org.opengroup.osdu.storage.util.*
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.google.gson.Gson
;
public
class
TestRecordsApiAcceptance
extends
RecordsApiAcceptanceTests
{
...
...
@@ -49,4 +53,39 @@ public class TestRecordsApiAcceptance extends RecordsApiAcceptanceTests {
this
.
testUtils
=
null
;
}
}
\ No newline at end of file
@Override
@Test
public
void
should_createNewRecord_withSpecialCharacter_ifEnabled
()
throws
Exception
{
final
long
currentTimeMillis
=
System
.
currentTimeMillis
();
final
String
RECORD_ID
=
TenantUtils
.
getTenantName
()
+
":inttest:testSpecialChars%abc%2Ffoobar-"
+
currentTimeMillis
;
final
String
ENCODED_RECORD_ID
=
TenantUtils
.
getTenantName
()
+
":inttest:testSpecialChars%25abc%252Ffoobar-"
+
currentTimeMillis
;
String
jsonInput
=
createJsonBody
(
RECORD_ID
,
"TestSpecialCharacters"
);
ClientResponse
response
=
TestUtils
.
send
(
"records"
,
"PUT"
,
HeaderUtils
.
getHeaders
(
TenantUtils
.
getTenantName
(),
testUtils
.
getToken
()),
jsonInput
,
""
);
String
json
=
response
.
getEntity
(
String
.
class
);
assertEquals
(
201
,
response
.
getStatus
());
assertTrue
(
response
.
getType
().
toString
().
contains
(
"application/json"
));
Gson
gson
=
new
Gson
();
DummyRecordsHelper
.
CreateRecordResponse
result
=
gson
.
fromJson
(
json
,
DummyRecordsHelper
.
CreateRecordResponse
.
class
);
assertEquals
(
1
,
result
.
recordCount
);
assertEquals
(
1
,
result
.
recordIds
.
length
);
assertEquals
(
1
,
result
.
recordIdVersions
.
length
);
assertEquals
(
RECORD_ID
,
result
.
recordIds
[
0
]);
response
=
TestUtils
.
send
(
"records/"
+
ENCODED_RECORD_ID
,
"GET"
,
HeaderUtils
.
getHeaders
(
TenantUtils
.
getTenantName
(),
testUtils
.
getToken
()),
""
,
""
);
// Service does not allow URLs with suspicious characters, Which is the default setting.
// Different CSPs are responding with different status code for this error when a special character like %25 is present in the URL.
// Hence the Assert Statement is marked not to be 200.
// More details - https://community.opengroup.org/osdu/platform/system/storage/-/issues/61
assertNotEquals
(
200
,
response
.
getStatus
());
}
}
This diff is collapsed.
Click to expand it.
Abhay Joshi
@bios
mentioned in commit
a65ddc61
·
1 year ago
mentioned in commit
a65ddc61
mentioned in commit a65ddc616f4fd5737532762d5baf00c5fcfaf413
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment