Skip to content

Commit

Permalink
moved misplaced replica set tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianconcept committed Mar 1, 2024
1 parent 75d3206 commit 98ba549
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 80 deletions.
2 changes: 2 additions & 0 deletions src/BaselineOfMapless/BaselineOfMapless.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ BaselineOfMapless >> baseline: spec [
group: 'Mongo' with: #( 'Mapless-Mongo' );
group: 'Mongo-Tests'
with: #( 'Mapless-Mongo' 'Mapless-Mongo-Tests' );
group: 'Mongo-ReplicaSet-Tests'
with: #( 'Mapless-Mongo-ReplicaSet-Tests' );
group: 'Redis' with: #( 'Mapless-Redis' );
group: 'Redis-Tests'
with: #( 'Mapless-Redis' 'Mapless-Redis-Tests' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ MaplessReplicaSetMongoPoolTest >> testHasIdleClients [
self assert: pool hasIdleReadWriteClients
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testInitializeIsPrimary [

| api result |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ result := api isPrimary ] raise: Error.
self deny: result.
api close
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testInsertConcern [

Expand Down Expand Up @@ -180,6 +192,57 @@ MaplessReplicaSetMongoPoolTest >> testInstanceCreationFromMongoUrls [
equals: '1@localhost:27017' asMongoUrl
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testIsPrimary [

| api result |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self
shouldnt: [ result := api admin isMaster isPrimary ]
raise: Error.
self deny: result.
api close
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testIsReadOnly [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.
self assert: api isReadOnly.
api close
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testIsReadWrite [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.
self deny: api isReadWrite.
api close
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testIsType [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.

self assert: (api isType: #readOnly).
api close
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testReadConcern [

Expand All @@ -196,6 +259,23 @@ MaplessReplicaSetMongoPoolTest >> testReadConcern [
self assert: repository defaultReadConcern equals: #majority
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testResetRole [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.

self assert: (api isType: #readOnly).

self shouldnt: [ api resetIsPrimary ] raise: Error.
self shouldnt: [ api isPrimary ] raise: Error.
self assert: (api isType: #readOnly).
api close
]

{ #category : #tests }
MaplessReplicaSetMongoPoolTest >> testUpdateConcern [

Expand Down
80 changes: 0 additions & 80 deletions src/Mapless-Mongo-Tests/MaplessMongoAPITest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,83 +40,3 @@ MaplessMongoAPITest >> testGetMongoInfo [
self assert: api admin isMaster class equals: MongoIsMaster.
api close
]

{ #category : #tests }
MaplessMongoAPITest >> testInitializeIsPrimary [

| api result |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ result := api isPrimary ] raise: Error.
self deny: result.
api close
]

{ #category : #tests }
MaplessMongoAPITest >> testIsPrimary [

| api result |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self
shouldnt: [ result := api admin isMaster isPrimary ]
raise: Error.
self deny: result.
api close
]

{ #category : #tests }
MaplessMongoAPITest >> testIsReadOnly [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.
self assert: api isReadOnly.
api close
]

{ #category : #tests }
MaplessMongoAPITest >> testIsReadWrite [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.
self deny: api isReadWrite.
api close
]

{ #category : #tests }
MaplessMongoAPITest >> testIsType [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.

self assert: (api isType: #readOnly).
api close
]

{ #category : #tests }
MaplessMongoAPITest >> testResetRole [

| api |
api := MongoAPI mongoUrl: 'mongodb://localhost:27017/Mapless-Test'.
api open.

self shouldnt: [ api isPrimary ] raise: Error.

self assert: (api isType: #readOnly).

self shouldnt: [ api resetIsPrimary ] raise: Error.
self shouldnt: [ api isPrimary ] raise: Error.
self assert: (api isType: #readOnly).
api close
]

0 comments on commit 98ba549

Please sign in to comment.