-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnatty_test.go
1417 lines (1048 loc) · 62.3 KB
/
natty_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// NOTE: These tests require NATS to be available on "localhost"
package natty
import (
"context"
"crypto/tls"
"math/rand"
"strconv"
"strings"
"time"
"github.com/nats-io/nats.go"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
)
const (
NatsURL = "tls://localhost:4222"
)
var (
testStreams []string
testBuckets []string
tlsConfig = &tls.Config{
InsecureSkipVerify: true,
}
)
var _ = AfterSuite(func() {
// CleanupStreams streams
err := CleanupStreams(testStreams)
Expect(err).ToNot(HaveOccurred())
err = CleanupBuckets(testBuckets)
Expect(err).ToNot(HaveOccurred())
})
var _ = Describe("Natty", func() {
Describe("New", func() {
It("happy path", func() {
n, err := New(NewConfig())
Expect(err).ToNot(HaveOccurred())
Expect(n).ToNot(BeNil())
})
It("should connect when NatsURL contains a bad and good URL", func() {
cfg := NewConfig()
cfg.NatsURL = []string{
"nats://localhost:22",
NatsURL,
}
n, err := New(cfg)
Expect(err).ToNot(HaveOccurred())
Expect(n).ToNot(BeNil())
})
It("should fail with bad config options", func() {
type scenario struct {
cfg *Config
description string
shouldError bool
errorContains string
}
configs := []scenario{
{
cfg: nil,
description: "should fail with nil config",
shouldError: true,
errorContains: "config cannot be nil",
},
{
cfg: &Config{
NatsURL: nil,
MaxMsgs: 0,
FetchSize: 0,
FetchTimeout: 0,
DeliverPolicy: 0,
UseTLS: true,
},
description: "should fail with nil nats url",
shouldError: true,
errorContains: "NatsURL cannot be empty",
},
}
for _, v := range configs {
n, err := New(v.cfg)
if v.shouldError {
Expect(err).To(HaveOccurred(), v.description)
Expect(n).To(BeNil())
Expect(err.Error()).To(ContainSubstring(v.errorContains), v.description)
} else {
Expect(err).ToNot(HaveOccurred(), v.description)
Expect(n).ToNot(BeNil())
}
}
})
It("adding an existing stream and consumer should not error", func() {
cfg := NewConfig()
n, err := New(cfg)
Expect(err).ToNot(HaveOccurred())
Expect(n).ToNot(BeNil())
// Do it again
n, err = New(cfg)
Expect(err).ToNot(HaveOccurred())
Expect(n).ToNot(BeNil())
})
})
Describe("Consume", func() {
var (
cfg *Config
n *Natty
)
BeforeEach(func() {
var connectErr error
cfg = NewConfig()
n, connectErr = New(cfg)
Expect(connectErr).ToNot(HaveOccurred())
Expect(n).ToNot(BeNil())
})
It("should consume messages", func() {
ctx, cancel := context.WithCancel(context.Background())
consumed := make([]string, 0)
streamName := strings.ToUpper(GetRandomName("test", 1))
consumerName := GetRandomName("test", 1)
err := n.CreateStream(ctx, streamName, []string{streamName + ".*"})
Expect(err).ToNot(HaveOccurred())
err = n.CreateConsumer(ctx, streamName, consumerName)
Expect(err).ToNot(HaveOccurred())
subj := streamName + ".foo"
var exit bool
errChan := make(chan error, 1000)
// Launch consumer in a goroutine
go func() {
testStreams = append(testStreams, streamName)
consumerConfig := &ConsumerConfig{
Subject: subj,
StreamName: streamName,
ConsumerName: consumerName,
}
err := n.Consume(ctx, consumerConfig, func(ctx context.Context, msg *nats.Msg) error {
consumed = append(consumed, string(msg.Data))
return nil
})
Expect(err).ToNot(HaveOccurred())
exit = true
}()
// Launch a watcher for the err channel
go func() {
for {
select {
case <-ctx.Done():
return
case err := <-errChan:
Fail("unexpected recv on error channel: " + err.Error())
}
}
}()
// Produce 5 events
err = Publish(cfg, 5, subj, MustNewUUID())
Expect(err).ToNot(HaveOccurred())
// Give Consume() enough time to consume
time.Sleep(1 * time.Second)
cancel()
// Give Consume() enough time to exit
time.Sleep(1 * time.Second)
Expect(exit).To(BeTrue())
Expect(len(consumed)).To(Equal(5))
})
It("uses the filter subject", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
streamName := strings.ToUpper(GetRandomName("test", 1))
consumerName := GetRandomName("test", 1)
err := n.CreateStream(ctx, streamName, []string{streamName + ".*"})
Expect(err).ToNot(HaveOccurred())
goodFilter := streamName + ".foo"
badFilter := streamName + ".bar"
err = n.CreateConsumer(ctx, streamName, consumerName, goodFilter)
Expect(err).ToNot(HaveOccurred())
publishNumMessages := 100
// Publish some messages to streamName.foo
for i := 0; i < publishNumMessages; i++ {
n.Publish(ctx, goodFilter, []byte("good"))
}
// Publish some messages to streamName.bar
for i := 0; i < publishNumMessages; i++ {
n.Publish(ctx, badFilter, []byte("bad"))
}
// Publish is async - give it a second to actually get written
time.Sleep(time.Second)
doneCh := make(chan struct{}, 0)
consumed := make([]*nats.Msg, 0)
handler := func(ctx context.Context, msg *nats.Msg) error {
consumed = append(consumed, msg)
Expect(msg.Ack()).ToNot(HaveOccurred())
if len(consumed) == 100 {
doneCh <- struct{}{}
}
return nil
}
// Consumer should only receive for streamName.foo
go func() {
err = n.Consume(ctx, &ConsumerConfig{
StreamName: streamName,
Subject: goodFilter,
ConsumerName: consumerName,
}, handler)
Expect(err).ToNot(HaveOccurred())
}()
// Should receive data within 5 seconds
select {
case <-time.After(5 * time.Second):
Fail("consumer timed out waiting for message(s)")
case <-doneCh:
break
}
Expect(len(consumed)).To(Equal(publishNumMessages))
for _, m := range consumed {
Expect(m.Subject).To(Equal(goodFilter))
}
})
It("error watch channel is used", func() {
ctx, cancel := context.WithCancel(context.Background())
consumed := make([]string, 0)
streamName := strings.ToUpper(GetRandomName("test", 1))
consumerName := GetRandomName("test", 1)
err := n.CreateStream(ctx, streamName, []string{streamName + ".*"})
Expect(err).ToNot(HaveOccurred())
err = n.CreateConsumer(ctx, streamName, consumerName)
Expect(err).ToNot(HaveOccurred())
subj := streamName + ".foo"
var exit bool
errChan := make(chan error, 1000)
// Launch consumer in a goroutine
go func() {
consumerConfig := &ConsumerConfig{
Subject: subj,
StreamName: streamName,
ConsumerName: consumerName,
ErrorCh: errChan,
}
err := n.Consume(ctx, consumerConfig, func(ctx context.Context, msg *nats.Msg) error {
consumed = append(consumed, string(msg.Data))
return errors.New("stuff broke")
})
Expect(err).ToNot(HaveOccurred())
exit = true
}()
chanErrors := make([]error, 0)
// Expect watcher to get 5 errors
go func() {
for {
select {
case <-ctx.Done():
return
case err := <-errChan:
chanErrors = append(chanErrors, err)
}
}
}()
// Produce 5 events
err = Publish(cfg, 5, subj, MustNewUUID())
Expect(err).ToNot(HaveOccurred())
// Give Consume() enough time to consume
time.Sleep(1 * time.Second)
cancel()
// Give Consume() enough time to exit
time.Sleep(1 * time.Second)
Expect(exit).To(BeTrue())
Expect(len(consumed)).To(Equal(5))
Expect(len(chanErrors)).To(Equal(5))
})
})
Describe("Publish", func() {
var (
cfg *Config
n *Natty
)
BeforeEach(func() {
var err error
cfg = NewConfig()
n, err = New(cfg)
Expect(err).ToNot(HaveOccurred())
Expect(n).ToNot(BeNil())
})
It("should publish", func() {
const MessagesToPublish = 50
defer GinkgoRecover()
// Publish stuff
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
payload := MustNewUUID()
cfg := NewConfig()
streamName := strings.ToUpper(GetRandomName("test", 1))
err := n.CreateStream(context.Background(), streamName, []string{streamName + ".*"})
Expect(err).ToNot(HaveOccurred())
var hit int
// Create a consumer - expect to see a msg
go func() {
testStreams = append(testStreams, streamName)
natsClient, err := nats.Connect(cfg.NatsURL[0], nats.Secure(tlsConfig))
Expect(err).ToNot(HaveOccurred())
Expect(natsClient).ToNot(BeNil())
js, err := natsClient.JetStream()
Expect(err).ToNot(HaveOccurred())
Expect(js).ToNot(BeNil())
_, err = js.Subscribe(streamName+".foo", func(msg *nats.Msg) {
hit += 1
Expect(string(msg.Data)).To(Equal(payload))
msg.Ack()
})
Expect(err).ToNot(HaveOccurred())
}()
for i := 0; i < MessagesToPublish; i++ {
n.Publish(ctx, streamName+".foo", []byte(payload))
}
time.Sleep(5 * time.Second)
Expect(hit).To(Equal(MessagesToPublish))
})
})
Describe("CreateStream", func() {
It("should create a stream", func() {
cfg := &Config{
NatsURL: []string{NatsURL},
UseTLS: true,
TLSSkipVerify: true,
}
n, err := New(cfg)
Expect(err).ToNot(HaveOccurred())
name := "ingest-4beb5666-2e30-4b28-a87e-6222731601ec"
err = n.CreateStream(context.Background(), name, []string{name})
Expect(err).ToNot(HaveOccurred())
CleanupStreams([]string{name})
})
})
Describe("DeleteStream", func() {
It("should delete a stream", func() {
cfg := &Config{
NatsURL: []string{NatsURL},
UseTLS: true,
TLSSkipVerify: true,
}
n, err := New(cfg)
Expect(err).ToNot(HaveOccurred())
name := "ingest-4beb5666-2e30-4b28-a87e-6222731601ec"
err = n.CreateStream(context.Background(), name, []string{name})
Expect(err).ToNot(HaveOccurred())
err = n.DeleteStream(context.Background(), name)
Expect(err).ToNot(HaveOccurred())
})
})
Describe("CreateConsumer", func() {
It("should create a consumer", func() {
cfg := &Config{
NatsURL: []string{NatsURL},
UseTLS: true,
TLSSkipVerify: true,
}
n, err := New(cfg)
Expect(err).ToNot(HaveOccurred())
name := "ingest-" + MustNewUUID()
err = n.CreateStream(context.Background(), name, []string{name})
Expect(err).ToNot(HaveOccurred())
err = n.CreateConsumer(context.Background(), name, name+"-consumer")
Expect(err).ToNot(HaveOccurred())
CleanupStreams([]string{name})
})
})
Describe("DeleteConsumer", func() {
It("should delete a consumer", func() {
cfg := &Config{
NatsURL: []string{NatsURL},
UseTLS: true,
TLSSkipVerify: true,
}
n, err := New(cfg)
Expect(err).ToNot(HaveOccurred())
streamName := "ingest-" + MustNewUUID()
consumerName := streamName + "-consumer"
err = n.CreateStream(context.Background(), streamName, []string{streamName})
Expect(err).ToNot(HaveOccurred())
err = n.CreateConsumer(context.Background(), streamName, consumerName)
Expect(err).ToNot(HaveOccurred())
err = n.DeleteConsumer(context.Background(), consumerName, streamName)
Expect(err).ToNot(HaveOccurred())
CleanupStreams([]string{streamName})
})
})
})
func Publish(cfg *Config, num int, subj, payload string) error {
n, err := nats.Connect(cfg.NatsURL[0], nats.Secure(tlsConfig))
if err != nil {
return errors.Wrap(err, "unable to connect to nats in Publish()")
}
for i := 0; i != num; i++ {
if err := n.Publish(subj, []byte(payload)); err != nil {
return errors.Wrap(err, "unable to publish in Publish()")
}
}
return nil
}
func NewConfig() *Config {
return &Config{
NatsURL: []string{NatsURL},
FetchSize: 1,
FetchTimeout: 5 * time.Second,
DeliverPolicy: nats.DeliverNewPolicy,
UseTLS: true,
TLSSkipVerify: true,
}
}
func CleanupStreams(streams []string) error {
n, err := nats.Connect(NatsURL, nats.Secure(tlsConfig))
if err != nil {
return errors.Wrap(err, "unable to connect to NATS")
}
js, err := n.JetStream()
if err != nil {
return errors.Wrap(err, "unable to create JS context")
}
for _, v := range streams {
if err := js.DeleteStream(v); err != nil {
if err == nats.ErrStreamNotFound {
continue
}
return errors.Wrap(err, "unable to delete stream "+v)
}
}
return nil
}
func CleanupBuckets(buckets []string) error {
n, err := nats.Connect(NatsURL, nats.Secure(tlsConfig))
if err != nil {
return errors.Wrap(err, "unable to connect to NATS")
}
js, err := n.JetStream()
if err != nil {
return errors.Wrap(err, "unable to create JS context")
}
for _, v := range buckets {
if err := js.DeleteKeyValue(v); err != nil {
if err == nats.ErrStreamNotFound {
continue
}
return errors.Wrap(err, "unable to delete bucket")
}
}
return nil
}
// Random name generator code borrowed from here: https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go
var (
left = [...]string{
"admiring",
"adoring",
"affectionate",
"agitated",
"amazing",
"angry",
"awesome",
"beautiful",
"blissful",
"bold",
"boring",
"brave",
"busy",
"charming",
"clever",
"cool",
"compassionate",
"competent",
"condescending",
"confident",
"cranky",
"crazy",
"dazzling",
"determined",
"distracted",
"dreamy",
"eager",
"ecstatic",
"elastic",
"elated",
"elegant",
"eloquent",
"epic",
"exciting",
"fervent",
"festive",
"flamboyant",
"focused",
"friendly",
"frosty",
"funny",
"gallant",
"gifted",
"goofy",
"gracious",
"great",
"happy",
"hardcore",
"heuristic",
"hopeful",
"hungry",
"infallible",
"inspiring",
"interesting",
"intelligent",
"jolly",
"jovial",
"keen",
"kind",
"laughing",
"loving",
"lucid",
"magical",
"mystifying",
"modest",
"musing",
"naughty",
"nervous",
"nice",
"nifty",
"nostalgic",
"objective",
"optimistic",
"peaceful",
"pedantic",
"pensive",
"practical",
"priceless",
"quirky",
"quizzical",
"recursing",
"relaxed",
"reverent",
"romantic",
"sad",
"serene",
"sharp",
"silly",
"sleepy",
"stoic",
"strange",
"stupefied",
"suspicious",
"sweet",
"tender",
"thirsty",
"trusting",
"unruffled",
"upbeat",
"vibrant",
"vigilant",
"vigorous",
"wizardly",
"wonderful",
"xenodochial",
"youthful",
"zealous",
"zen",
}
// Docker, starting from 0.7.x, generates names from notable scientists and hackers.
// Please, for any amazing man that you add to the list, consider adding an equally amazing woman to it, and vice versa.
right = [...]string{
// Maria Gaetana Agnesi - Italian mathematician, philosopher, theologian and humanitarian. She was the first woman to write a mathematics handbook and the first woman appointed as a Mathematics Professor at a University. https://en.wikipedia.org/wiki/Maria_Gaetana_Agnesi
"agnesi",
// Muhammad ibn Jābir al-Ḥarrānī al-Battānī was a founding father of astronomy. https://en.wikipedia.org/wiki/Mu%E1%B8%A5ammad_ibn_J%C4%81bir_al-%E1%B8%A4arr%C4%81n%C4%AB_al-Batt%C4%81n%C4%AB
"albattani",
// Frances E. Allen, became the first female IBM Fellow in 1989. In 2006, she became the first female recipient of the ACM's Turing Award. https://en.wikipedia.org/wiki/Frances_E._Allen
"allen",
// June Almeida - Scottish virologist who took the first pictures of the rubella virus - https://en.wikipedia.org/wiki/June_Almeida
"almeida",
// Kathleen Antonelli, American computer programmer and one of the six original programmers of the ENIAC - https://en.wikipedia.org/wiki/Kathleen_Antonelli
"antonelli",
// Archimedes was a physicist, engineer and mathematician who invented too many things to list them here. https://en.wikipedia.org/wiki/Archimedes
"archimedes",
// Maria Ardinghelli - Italian translator, mathematician and physicist - https://en.wikipedia.org/wiki/Maria_Ardinghelli
"ardinghelli",
// Aryabhata - Ancient Indian mathematician-astronomer during 476-550 CE https://en.wikipedia.org/wiki/Aryabhata
"aryabhata",
// Wanda Austin - Wanda Austin is the President and CEO of The Aerospace Corporation, a leading architect for the US security space programs. https://en.wikipedia.org/wiki/Wanda_Austin
"austin",
// Charles Babbage invented the concept of a programmable computer. https://en.wikipedia.org/wiki/Charles_Babbage.
"babbage",
// Stefan Banach - Polish mathematician, was one of the founders of modern functional analysis. https://en.wikipedia.org/wiki/Stefan_Banach
"banach",
// Buckaroo Banzai and his mentor Dr. Hikita perfected the "oscillation overthruster", a device that allows one to pass through solid matter. - https://en.wikipedia.org/wiki/The_Adventures_of_Buckaroo_Banzai_Across_the_8th_Dimension
"banzai",
// John Bardeen co-invented the transistor - https://en.wikipedia.org/wiki/John_Bardeen
"bardeen",
// Jean Bartik, born Betty Jean Jennings, was one of the original programmers for the ENIAC computer. https://en.wikipedia.org/wiki/Jean_Bartik
"bartik",
// Laura Bassi, the world's first female professor https://en.wikipedia.org/wiki/Laura_Bassi
"bassi",
// Hugh Beaver, British engineer, founder of the Guinness Book of World Records https://en.wikipedia.org/wiki/Hugh_Beaver
"beaver",
// Alexander Graham Bell - an eminent Scottish-born scientist, inventor, engineer and innovator who is credited with inventing the first practical telephone - https://en.wikipedia.org/wiki/Alexander_Graham_Bell
"bell",
// Karl Friedrich Benz - a German automobile engineer. Inventor of the first practical motorcar. https://en.wikipedia.org/wiki/Karl_Benz
"benz",
// Homi J Bhabha - was an Indian nuclear physicist, founding director, and professor of physics at the Tata Institute of Fundamental Research. Colloquially known as "father of Indian nuclear programme"- https://en.wikipedia.org/wiki/Homi_J._Bhabha
"bhabha",
// Bhaskara II - Ancient Indian mathematician-astronomer whose work on calculus predates Newton and Leibniz by over half a millennium - https://en.wikipedia.org/wiki/Bh%C4%81skara_II#Calculus
"bhaskara",
// Sue Black - British computer scientist and campaigner. She has been instrumental in saving Bletchley Park, the site of World War II codebreaking - https://en.wikipedia.org/wiki/Sue_Black_(computer_scientist)
"black",
// Elizabeth Helen Blackburn - Australian-American Nobel laureate; best known for co-discovering telomerase. https://en.wikipedia.org/wiki/Elizabeth_Blackburn
"blackburn",
// Elizabeth Blackwell - American doctor and first American woman to receive a medical degree - https://en.wikipedia.org/wiki/Elizabeth_Blackwell
"blackwell",
// Niels Bohr is the father of quantum theory. https://en.wikipedia.org/wiki/Niels_Bohr.
"bohr",
// Kathleen Booth, she's credited with writing the first assembly language. https://en.wikipedia.org/wiki/Kathleen_Booth
"booth",
// Anita Borg - Anita Borg was the founding director of the Institute for Women and Technology (IWT). https://en.wikipedia.org/wiki/Anita_Borg
"borg",
// Satyendra Nath Bose - He provided the foundation for Bose–Einstein statistics and the theory of the Bose–Einstein condensate. - https://en.wikipedia.org/wiki/Satyendra_Nath_Bose
"bose",
// Katherine Louise Bouman is an imaging scientist and Assistant Professor of Computer Science at the California Institute of Technology. She researches computational methods for imaging, and developed an algorithm that made possible the picture first visualization of a black hole using the Event Horizon Telescope. - https://en.wikipedia.org/wiki/Katie_Bouman
"bouman",
// Evelyn Boyd Granville - She was one of the first African-American woman to receive a Ph.D. in mathematics; she earned it in 1949 from Yale University. https://en.wikipedia.org/wiki/Evelyn_Boyd_Granville
"boyd",
// Brahmagupta - Ancient Indian mathematician during 598-670 CE who gave rules to compute with zero - https://en.wikipedia.org/wiki/Brahmagupta#Zero
"brahmagupta",
// Walter Houser Brattain co-invented the transistor - https://en.wikipedia.org/wiki/Walter_Houser_Brattain
"brattain",
// Emmett Brown invented time travel. https://en.wikipedia.org/wiki/Emmett_Brown (thanks Brian Goff)
"brown",
// Linda Brown Buck - American biologist and Nobel laureate best known for her genetic and molecular analyses of the mechanisms of smell. https://en.wikipedia.org/wiki/Linda_B._Buck
"buck",
// Dame Susan Jocelyn Bell Burnell - Northern Irish astrophysicist who discovered radio pulsars and was the first to analyse them. https://en.wikipedia.org/wiki/Jocelyn_Bell_Burnell
"burnell",
// Annie Jump Cannon - pioneering female astronomer who classified hundreds of thousands of stars and created the system we use to understand stars today. https://en.wikipedia.org/wiki/Annie_Jump_Cannon
"cannon",
// Rachel Carson - American marine biologist and conservationist, her book Silent Spring and other writings are credited with advancing the global environmental movement. https://en.wikipedia.org/wiki/Rachel_Carson
"carson",
// Dame Mary Lucy Cartwright - British mathematician who was one of the first to study what is now known as chaos theory. Also known for Cartwright's theorem which finds applications in signal processing. https://en.wikipedia.org/wiki/Mary_Cartwright
"cartwright",
// George Washington Carver - American agricultural scientist and inventor. He was the most prominent black scientist of the early 20th century. https://en.wikipedia.org/wiki/George_Washington_Carver
"carver",
// Vinton Gray Cerf - American Internet pioneer, recognised as one of "the fathers of the Internet". With Robert Elliot Kahn, he designed TCP and IP, the primary data communication protocols of the Internet and other computer networks. https://en.wikipedia.org/wiki/Vint_Cerf
"cerf",
// Subrahmanyan Chandrasekhar - Astrophysicist known for his mathematical theory on different stages and evolution in structures of the stars. He has won nobel prize for physics - https://en.wikipedia.org/wiki/Subrahmanyan_Chandrasekhar
"chandrasekhar",
// Sergey Alexeyevich Chaplygin (Russian: Серге́й Алексе́евич Чаплы́гин; April 5, 1869 – October 8, 1942) was a Russian and Soviet physicist, mathematician, and mechanical engineer. He is known for mathematical formulas such as Chaplygin's equation and for a hypothetical substance in cosmology called Chaplygin gas, named after him. https://en.wikipedia.org/wiki/Sergey_Chaplygin
"chaplygin",
// Émilie du Châtelet - French natural philosopher, mathematician, physicist, and author during the early 1730s, known for her translation of and commentary on Isaac Newton's book Principia containing basic laws of physics. https://en.wikipedia.org/wiki/%C3%89milie_du_Ch%C3%A2telet
"chatelet",
// Asima Chatterjee was an Indian organic chemist noted for her research on vinca alkaloids, development of drugs for treatment of epilepsy and malaria - https://en.wikipedia.org/wiki/Asima_Chatterjee
"chatterjee",
// David Lee Chaum - American computer scientist and cryptographer. Known for his seminal contributions in the field of anonymous communication. https://en.wikipedia.org/wiki/David_Chaum
"chaum",
// Pafnuty Chebyshev - Russian mathematician. He is known fo his works on probability, statistics, mechanics, analytical geometry and number theory https://en.wikipedia.org/wiki/Pafnuty_Chebyshev
"chebyshev",
// Joan Clarke - Bletchley Park code breaker during the Second World War who pioneered techniques that remained top secret for decades. Also an accomplished numismatist https://en.wikipedia.org/wiki/Joan_Clarke
"clarke",
// Bram Cohen - American computer programmer and author of the BitTorrent peer-to-peer protocol. https://en.wikipedia.org/wiki/Bram_Cohen
"cohen",
// Jane Colden - American botanist widely considered the first female American botanist - https://en.wikipedia.org/wiki/Jane_Colden
"colden",
// Gerty Theresa Cori - American biochemist who became the third woman—and first American woman—to win a Nobel Prize in science, and the first woman to be awarded the Nobel Prize in Physiology or Medicine. Cori was born in Prague. https://en.wikipedia.org/wiki/Gerty_Cori
"cori",
// Seymour Roger Cray was an American electrical engineer and supercomputer architect who designed a series of computers that were the fastest in the world for decades. https://en.wikipedia.org/wiki/Seymour_Cray
"cray",
// This entry reflects a husband and wife team who worked together:
// Joan Curran was a Welsh scientist who developed radar and invented chaff, a radar countermeasure. https://en.wikipedia.org/wiki/Joan_Curran
// Samuel Curran was an Irish physicist who worked alongside his wife during WWII and invented the proximity fuse. https://en.wikipedia.org/wiki/Samuel_Curran
"curran",
// Marie Curie discovered radioactivity. https://en.wikipedia.org/wiki/Marie_Curie.
"curie",
// Charles Darwin established the principles of natural evolution. https://en.wikipedia.org/wiki/Charles_Darwin.
"darwin",
// Leonardo Da Vinci invented too many things to list here. https://en.wikipedia.org/wiki/Leonardo_da_Vinci.
"davinci",
// A. K. (Alexander Keewatin) Dewdney, Canadian mathematician, computer scientist, author and filmmaker. Contributor to Scientific American's "Computer Recreations" from 1984 to 1991. Author of Core War (program), The Planiverse, The Armchair Universe, The Magic Machine, The New Turing Omnibus, and more. https://en.wikipedia.org/wiki/Alexander_Dewdney
"dewdney",
// Satish Dhawan - Indian mathematician and aerospace engineer, known for leading the successful and indigenous development of the Indian space programme. https://en.wikipedia.org/wiki/Satish_Dhawan
"dhawan",
// Bailey Whitfield Diffie - American cryptographer and one of the pioneers of public-key cryptography. https://en.wikipedia.org/wiki/Whitfield_Diffie
"diffie",
// Edsger Wybe Dijkstra was a Dutch computer scientist and mathematical scientist. https://en.wikipedia.org/wiki/Edsger_W._Dijkstra.
"dijkstra",
// Paul Adrien Maurice Dirac - English theoretical physicist who made fundamental contributions to the early development of both quantum mechanics and quantum electrodynamics. https://en.wikipedia.org/wiki/Paul_Dirac
"dirac",
// Agnes Meyer Driscoll - American cryptanalyst during World Wars I and II who successfully cryptanalysed a number of Japanese ciphers. She was also the co-developer of one of the cipher machines of the US Navy, the CM. https://en.wikipedia.org/wiki/Agnes_Meyer_Driscoll
"driscoll",
// Donna Dubinsky - played an integral role in the development of personal digital assistants (PDAs) serving as CEO of Palm, Inc. and co-founding Handspring. https://en.wikipedia.org/wiki/Donna_Dubinsky
"dubinsky",
// Annie Easley - She was a leading member of the team which developed software for the Centaur rocket stage and one of the first African-Americans in her field. https://en.wikipedia.org/wiki/Annie_Easley
"easley",
// Thomas Alva Edison, prolific inventor https://en.wikipedia.org/wiki/Thomas_Edison
"edison",
// Albert Einstein invented the general theory of relativity. https://en.wikipedia.org/wiki/Albert_Einstein
"einstein",
// Alexandra Asanovna Elbakyan (Russian: Алекса́ндра Аса́новна Элбакя́н) is a Kazakhstani graduate student, computer programmer, internet pirate in hiding, and the creator of the site Sci-Hub. Nature has listed her in 2016 in the top ten people that mattered in science, and Ars Technica has compared her to Aaron Swartz. - https://en.wikipedia.org/wiki/Alexandra_Elbakyan
"elbakyan",
// Taher A. ElGamal - Egyptian cryptographer best known for the ElGamal discrete log cryptosystem and the ElGamal digital signature scheme. https://en.wikipedia.org/wiki/Taher_Elgamal
"elgamal",
// Gertrude Elion - American biochemist, pharmacologist and the 1988 recipient of the Nobel Prize in Medicine - https://en.wikipedia.org/wiki/Gertrude_Elion
"elion",
// James Henry Ellis - British engineer and cryptographer employed by the GCHQ. Best known for conceiving for the first time, the idea of public-key cryptography. https://en.wikipedia.org/wiki/James_H._Ellis
"ellis",
// Douglas Engelbart gave the mother of all demos: https://en.wikipedia.org/wiki/Douglas_Engelbart
"engelbart",
// Euclid invented geometry. https://en.wikipedia.org/wiki/Euclid
"euclid",
// Leonhard Euler invented large parts of modern mathematics. https://de.wikipedia.org/wiki/Leonhard_Euler
"euler",
// Michael Faraday - British scientist who contributed to the study of electromagnetism and electrochemistry. https://en.wikipedia.org/wiki/Michael_Faraday
"faraday",
// Horst Feistel - German-born American cryptographer who was one of the earliest non-government researchers to study the design and theory of block ciphers. Co-developer of DES and Lucifer. Feistel networks, a symmetric structure used in the construction of block ciphers are named after him. https://en.wikipedia.org/wiki/Horst_Feistel
"feistel",
// Pierre de Fermat pioneered several aspects of modern mathematics. https://en.wikipedia.org/wiki/Pierre_de_Fermat
"fermat",
// Enrico Fermi invented the first nuclear reactor. https://en.wikipedia.org/wiki/Enrico_Fermi.
"fermi",
// Richard Feynman was a key contributor to quantum mechanics and particle physics. https://en.wikipedia.org/wiki/Richard_Feynman
"feynman",
// Benjamin Franklin is famous for his experiments in electricity and the invention of the lightning rod.
"franklin",
// Yuri Alekseyevich Gagarin - Soviet pilot and cosmonaut, best known as the first human to journey into outer space. https://en.wikipedia.org/wiki/Yuri_Gagarin
"gagarin",
// Galileo was a founding father of modern astronomy, and faced politics and obscurantism to establish scientific truth. https://en.wikipedia.org/wiki/Galileo_Galilei
"galileo",
// Évariste Galois - French mathematician whose work laid the foundations of Galois theory and group theory, two major branches of abstract algebra, and the subfield of Galois connections, all while still in his late teens. https://en.wikipedia.org/wiki/%C3%89variste_Galois
"galois",
// Kadambini Ganguly - Indian physician, known for being the first South Asian female physician, trained in western medicine, to graduate in South Asia. https://en.wikipedia.org/wiki/Kadambini_Ganguly
"ganguly",
// William Henry "Bill" Gates III is an American business magnate, philanthropist, investor, computer programmer, and inventor. https://en.wikipedia.org/wiki/Bill_Gates
"gates",
// Johann Carl Friedrich Gauss - German mathematician who made significant contributions to many fields, including number theory, algebra, statistics, analysis, differential geometry, geodesy, geophysics, mechanics, electrostatics, magnetic fields, astronomy, matrix theory, and optics. https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss
"gauss",
// Marie-Sophie Germain - French mathematician, physicist and philosopher. Known for her work on elasticity theory, number theory and philosophy. https://en.wikipedia.org/wiki/Sophie_Germain
"germain",
// Adele Goldberg, was one of the designers and developers of the Smalltalk language. https://en.wikipedia.org/wiki/Adele_Goldberg_(computer_scientist)
"goldberg",
// Adele Goldstine, born Adele Katz, wrote the complete technical description for the first electronic digital computer, ENIAC. https://en.wikipedia.org/wiki/Adele_Goldstine
"goldstine",
// Shafi Goldwasser is a computer scientist known for creating theoretical foundations of modern cryptography. Winner of 2012 ACM Turing Award. https://en.wikipedia.org/wiki/Shafi_Goldwasser
"goldwasser",
// James Golick, all around gangster.
"golick",
// Jane Goodall - British primatologist, ethologist, and anthropologist who is considered to be the world's foremost expert on chimpanzees - https://en.wikipedia.org/wiki/Jane_Goodall
"goodall",
// Stephen Jay Gould was was an American paleontologist, evolutionary biologist, and historian of science. He is most famous for the theory of punctuated equilibrium - https://en.wikipedia.org/wiki/Stephen_Jay_Gould
"gould",
// Carolyn Widney Greider - American molecular biologist and joint winner of the 2009 Nobel Prize for Physiology or Medicine for the discovery of telomerase. https://en.wikipedia.org/wiki/Carol_W._Greider
"greider",
// Alexander Grothendieck - German-born French mathematician who became a leading figure in the creation of modern algebraic geometry. https://en.wikipedia.org/wiki/Alexander_Grothendieck
"grothendieck",
// Lois Haibt - American computer scientist, part of the team at IBM that developed FORTRAN - https://en.wikipedia.org/wiki/Lois_Haibt
"haibt",
// Margaret Hamilton - Director of the Software Engineering Division of the MIT Instrumentation Laboratory, which developed on-board flight software for the Apollo space program. https://en.wikipedia.org/wiki/Margaret_Hamilton_(scientist)
"hamilton",
// Caroline Harriet Haslett - English electrical engineer, electricity industry administrator and champion of women's rights. Co-author of British Standard 1363 that specifies AC power plugs and sockets used across the United Kingdom (which is widely considered as one of the safest designs). https://en.wikipedia.org/wiki/Caroline_Haslett
"haslett",
// Stephen Hawking pioneered the field of cosmology by combining general relativity and quantum mechanics. https://en.wikipedia.org/wiki/Stephen_Hawking
"hawking",
// Martin Edward Hellman - American cryptologist, best known for his invention of public-key cryptography in co-operation with Whitfield Diffie and Ralph Merkle. https://en.wikipedia.org/wiki/Martin_Hellman
"hellman",
// Werner Heisenberg was a founding father of quantum mechanics. https://en.wikipedia.org/wiki/Werner_Heisenberg
"heisenberg",
// Grete Hermann was a German philosopher noted for her philosophical work on the foundations of quantum mechanics. https://en.wikipedia.org/wiki/Grete_Hermann
"hermann",
// Caroline Lucretia Herschel - German astronomer and discoverer of several comets. https://en.wikipedia.org/wiki/Caroline_Herschel
"herschel",
// Heinrich Rudolf Hertz - German physicist who first conclusively proved the existence of the electromagnetic waves. https://en.wikipedia.org/wiki/Heinrich_Hertz
"hertz",
// Jaroslav Heyrovský was the inventor of the polarographic method, father of the electroanalytical method, and recipient of the Nobel Prize in 1959. His main field of work was polarography. https://en.wikipedia.org/wiki/Jaroslav_Heyrovsk%C3%BD
"heyrovsky",
// Dorothy Hodgkin was a British biochemist, credited with the development of protein crystallography. She was awarded the Nobel Prize in Chemistry in 1964. https://en.wikipedia.org/wiki/Dorothy_Hodgkin
"hodgkin",
// Douglas R. Hofstadter is an American professor of cognitive science and author of the Pulitzer Prize and American Book Award-winning work Goedel, Escher, Bach: An Eternal Golden Braid in 1979. A mind-bending work which coined Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's Law." https://en.wikipedia.org/wiki/Douglas_Hofstadter
"hofstadter",