MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestConf

Function TestConf

conf/config_test.go:38–162  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36const testFile = "./.configtest"
37
38func TestConf(t *testing.T) {
39 log.SetLevel(log.DebugLevel)
40 var BPPubkey = new(asymmetric.PublicKey)
41 pubKeyBytes, err := hex.DecodeString("02c1db96f2ba7e1cb4e9822d12de0f63fb666feb828c7f509e81fab9bd7a34039c")
42 if err != nil {
43 t.Errorf("decode pubkey failed: %v", err)
44 }
45 err = BPPubkey.UnmarshalBinary(pubKeyBytes)
46 if err != nil {
47 t.Errorf("unmarshal pubkey failed: %v", err)
48 }
49 log.Debugf("pubkey: %x", BPPubkey.Serialize())
50 rawBytes := []byte("Space Cowboy")
51 h := hash.THashH(rawBytes)
52
53 log.SetLevel(log.DebugLevel)
54 BP := &BPInfo{
55 PublicKey: BPPubkey,
56 NodeID: "00000000000589366268c274fdc11ec8bdb17e668d2f619555a2e9c1a29c91d8",
57 RawNodeID: proto.RawNodeID{},
58 Nonce: cpuminer.Uint256{
59 A: 14396347928,
60 B: 0,
61 C: 0,
62 D: 6148914694092305796,
63 },
64 ChainFileName: "",
65 BPGenesis: BPGenesisInfo{
66 Version: 1,
67 Timestamp: time.Now().UTC(),
68 },
69 }
70 Convey("LoadConfig", t, func() {
71 defer os.Remove(testFile)
72 config := &Config{
73 UseTestMasterKey: false,
74 GenerateKeyPair: false,
75 WorkingRoot: "",
76 PubKeyStoreFile: "",
77 PrivateKeyFile: "",
78 DHTFileName: "",
79 ListenAddr: "",
80 ThisNodeID: "",
81 ValidDNSKeys: map[string]string{
82 // Cloudflare.com DNSKEY. SEE: `dig +multi cloudflare.com DNSKEY`
83 "koPbw9wmYZ7ggcjnQ6ayHyhHaDNMYELKTqT+qRGrZpWSccr/lBcrm10Z1PuQHB3Azhii+sb0PYFkH1ruxLhe5g==": "cloudflare.com",
84 "mdsswUyr3DPW132mOi8V9xESWE8jTo0dxCjjnopKl+GqJxpVXckHAeF+KkxLbxILfDLUT0rAK9iUzy1L53eKGQ==": "cloudflare.com",
85 },
86 MinNodeIDDifficulty: 2,
87 DNSSeed: DNSSeed{
88 EnforcedDNSSEC: true,
89 DNSServers: []string{
90 "1.1.1.1",
91 "202.46.34.74",
92 "202.46.34.75",
93 "202.46.34.76",
94 },
95 },

Callers

nothing calls this directly

Calls 10

SetLevelFunction · 0.92
DebugfFunction · 0.92
THashHFunction · 0.92
NodeIDTypeAlias · 0.92
ErrorfMethod · 0.80
MarshalMethod · 0.80
LoadConfigFunction · 0.70
UnmarshalBinaryMethod · 0.45
SerializeMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected