-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support classic ingest keys #238
Changes from all commits
857ee1d
0cd4d18
0021bac
451b36d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,41 @@ | |
expect(configuration.write_key).to eq write_key | ||
end | ||
|
||
describe "#classic?" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spec the classicness of the various key formats once here. |
||
it "is true when no key is set" do | ||
configuration.write_key = nil | ||
expect(configuration.classic?).to be true | ||
end | ||
|
||
it "is true with a classic key" do | ||
configuration.write_key = "c1a551c000d68f9ed1e96432ac1a3380" | ||
expect(configuration.classic?).to be true | ||
end | ||
|
||
it "is true with a classic v3 ingest key" do | ||
configuration.write_key = "hcaic_1234567890123456789012345678901234567890123456789012345678" | ||
expect(configuration.classic?).to be true | ||
end | ||
|
||
it "is false with an E&S key" do | ||
configuration.write_key = "1234567890123456789012" | ||
expect(configuration.classic?).to be false | ||
end | ||
|
||
it "is false with an E&S v3 ingest key" do | ||
configuration.write_key = "hcaik_1234567890123456789012345678901234567890123456789012345678" | ||
expect(configuration.classic?).to be false | ||
end | ||
|
||
it "is false with a v3 key id only" do | ||
configuration.write_key = "hcxik_12345678901234567890123456" | ||
expect(configuration.classic?).to be false | ||
end | ||
end | ||
|
||
describe "#service_name" do | ||
it "returns the default unknown-service:<process_name> when not set" do | ||
expect(configuration.instance_variable_get(:@service_name)).to be_nil | ||
# rspec is the expected process name because *this test suite* is rspec | ||
expect(configuration.service_name).to eq "unknown_service:rspec" | ||
end | ||
|
@@ -61,10 +94,12 @@ | |
|
||
context "with a classic write key" do | ||
before do | ||
configuration.write_key = "c1a551c000d68f9ed1e96432ac1a3380" | ||
allow(configuration).to receive(:classic?).and_return(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stub the classic check within "classic" test scopes instead of repeating the matrix of key types all over again. |
||
end | ||
|
||
it "returns the value of dataset when service_name isn't set" do | ||
expect(configuration.instance_variable_get(:@service_name)).to be_nil | ||
|
||
configuration.dataset = "a_dataset" | ||
expect(configuration.service_name).to eq "a_dataset" | ||
end | ||
|
@@ -105,11 +140,12 @@ | |
|
||
context "with a classic write key" do | ||
before do | ||
configuration.write_key = "c1a551c000d68f9ed1e96432ac1a3380" | ||
allow(configuration).to receive(:classic?).and_return(true) | ||
end | ||
|
||
it "returns whatever dataset has been set" do | ||
expect(configuration.dataset).to be_nil | ||
|
||
configuration.dataset = "a_dataset" | ||
expect(configuration.dataset).to eq "a_dataset" | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a private method and its only use was to set the
classic
instance variable on@context
.@context.classic
is set now by asking theconfiguration
object directly about its classicness.