Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -D option to get departed members. Fix get persistence error (#169)
- Loading branch information
1 parent
b1294eb
commit e747b6d
Showing
13 changed files
with
245 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* https://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
. "github.com/onsi/gomega" | ||
"github.com/oracle/coherence-cli/pkg/config" | ||
"testing" | ||
) | ||
|
||
func TestDecodeMemberDetails(t *testing.T) { | ||
var ( | ||
result []config.DepartedMembers | ||
g = NewGomegaWithT(t) | ||
invalid1 = []string{"rubbish"} | ||
invalid2 = []string{"Id=4, Timestamp=2024-03-26 08:11:00.537, Address=127.0.0.1:50250, MachineId=10131, Location=machine:localhost,process:6601,member:storage-4, Role=CoherenceServer)"} | ||
invalid3 = []string{"MemberId=4, Timestamp=2024-03-26 08:11:00.537, Address=127.0.0.1:50250, MachineId=10131, Location=machine:localhost,process:6601,member:storage-4, Role=CoherenceServer)"} | ||
valid1 = []string{"Member(Id=4, Timestamp=2024-03-26 08:11:00.537, Address=127.0.0.1:50250, MachineId=10131, Location=machine:localhost,process:6601,member:storage-4, Role=CoherenceServer)"} | ||
valid2 = []string{ | ||
"Member(Id=4, Timestamp=2024-03-26 08:11:00.537, Address=127.0.0.1:50250, MachineId=10131, Location=machine:localhost,process:6601,member:storage-4, Role=CoherenceServer)", | ||
"Member(Id=3, Timestamp=2024-03-26 08:11:00.536, Address=127.0.0.1:50259, MachineId=10135, Location=machine:localhost,process:6601,member:storage-5, Role=CoherenceServer1)"} | ||
) | ||
|
||
_, err := decodeDepartedMembers(invalid1) | ||
g.Expect(err).To(HaveOccurred()) | ||
|
||
_, err = decodeDepartedMembers(invalid2) | ||
g.Expect(err).To(HaveOccurred()) | ||
|
||
_, err = decodeDepartedMembers(invalid3) | ||
g.Expect(err).To(HaveOccurred()) | ||
|
||
result, err = decodeDepartedMembers(valid1) | ||
g.Expect(err).To(Not(HaveOccurred())) | ||
g.Expect(result).To(Not(BeNil())) | ||
g.Expect(len(result)).To(Equal(1)) | ||
g.Expect(result[0].NodeID).To(Equal("4")) | ||
g.Expect(result[0].TimeStamp).To(Equal("2024-03-26 08:11:00.537")) | ||
g.Expect(result[0].Address).To(Equal("127.0.0.1:50250")) | ||
g.Expect(result[0].MachineID).To(Equal("10131")) | ||
g.Expect(result[0].Location).To(Equal("machine:localhost,process:6601,member:storage-4")) | ||
g.Expect(result[0].Role).To(Equal("CoherenceServer")) | ||
|
||
result, err = decodeDepartedMembers(valid2) | ||
g.Expect(err).To(Not(HaveOccurred())) | ||
g.Expect(result).To(Not(BeNil())) | ||
g.Expect(len(result)).To(Equal(2)) | ||
g.Expect(result[0].NodeID).To(Equal("4")) | ||
g.Expect(result[0].TimeStamp).To(Equal("2024-03-26 08:11:00.537")) | ||
g.Expect(result[0].Address).To(Equal("127.0.0.1:50250")) | ||
g.Expect(result[0].MachineID).To(Equal("10131")) | ||
g.Expect(result[0].Location).To(Equal("machine:localhost,process:6601,member:storage-4")) | ||
g.Expect(result[0].Role).To(Equal("CoherenceServer")) | ||
|
||
g.Expect(result[1].NodeID).To(Equal("3")) | ||
g.Expect(result[1].TimeStamp).To(Equal("2024-03-26 08:11:00.536")) | ||
g.Expect(result[1].Address).To(Equal("127.0.0.1:50259")) | ||
g.Expect(result[1].MachineID).To(Equal("10135")) | ||
g.Expect(result[1].Location).To(Equal("machine:localhost,process:6601,member:storage-5")) | ||
g.Expect(result[1].Role).To(Equal("CoherenceServer1")) | ||
} |
Oops, something went wrong.