TypeError: no implicit conversion of Array into String when checking size of Array in the test expect block
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- ruby
- Ambito
- testing-qa
Direzione di ricerca
Inizia con il test Ruby di esempio e il blocco expect che chiama taskArray.count, quindi eseguilo con logstash -e "the file" -t per riprodurre il TypeError. Traccia la gestione di expect da parte del framework di test e verifica che il controllo della dimensione dell’array estratto venga completato correttamente senza l’eccezione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Logstash information:
Please include the following information:
- Logstash version (e.g.
bin/logstash --version) 8.9.1 - Logstash installation source (e.g. built from source, with a package manager: DEB/RPM, expanded from tar or zip archive, docker) RPM
- How is Logstash being run (e.g. as a service/service manager: systemd, upstart, etc. Via command line, docker/kubernetes) service most of the time, command line for running ruby tests
- How was the Logstash Plugin installed sudo yum install logstash
JVM (e.g. java -version): Open JDK 11.0.19
OS version (uname -a if on a Unix-like system): Red Hat Linux 7.x
Description of the problem including expected versus actual behavior: Cannot check size/length of array in the expect block of the testing framework. Error is {"exception"=>"#<TypeError: no implicit conversion of Array into String>"
Steps to reproduce:
Please include a minimal but complete recreation of the problem,
including (e.g.) pipeline definition(s), settings, locale, etc. The easier
you make for us to reproduce it, the more likely that somebody will take the
time to look at it.
- Create a .rb file with the filter and test methods
- Filter should instantiate JSON array and set it in the event - eg. event.set("myarray", the_array)
- Implement in_event block in the test with example JSON that includes an array.
- Implement expect block to check size of the array which was set in the filter event. None of the usual methods work: length, size, count
- Execute test on command line. eg. logstash -e "the file" -t
- Above error is reported.
Sample code):
def filter(event)
taskArray = Array.new
errorElements = event.get("[error]")
if errorElements.is_a? Array
errorElements.each_index { |x|
taskArray.push(errorElements[x]["task"])
}
end
event.set("error_task_array", taskArray)
return [event]
end
test "get task array" do
in_event {
{
"name":"job1",
"error":[
{
"task":"75fc",
"message":{
"ietf-restconf:errors":{
"error":[
{
"error-type":"application",
"error-tag":"malformed-message",
"error-path":"/pathto/problem",
"error-message":"missing element: name in thepath"
}
]
}
},
"timestamp":1.695060733555E+12
},
{
"task":"job",
"message":"Job has no available transitions. 6649, cb04, f5dd could have led to the workflow end task, but did not. These tasks performed in a way that the end of the workflow could not be reached.",
"timestamp":1.69506073357E+12
}
]
}
}
expect("extracts the task array") do |events|
taskArray = events[0].get(["error_task_array"])
taskArray.count == 2
end # expect
end # test
- Lingua principale
- Ruby
- Stelle
- 18
- Fork
- 32
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di logstash-plugins/logstash-filter-ruby
-
bug status:needs-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
exception-handling
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
-
Ruby exceptions log levelForse di nuovo libera @guyboertje l’ha presa 2907 giorni fa e non c’è nessuna pull request aperta. Apertaexception-handling logging-improvements
logstash-plugins/logstash-filter-ruby#49 · 2 commenti · 2 assegnatari ·
-
docs
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
logstash-plugins/logstash-filter-ruby#42 · 3 commenti · 1 reazione ·
Tutte le issue di logstash-plugins/logstash-filter-ruby
Issue simili
-
Feature Feature Parity
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
valkey-io/valkey-glide-ruby#369 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
thewca/worldcubeassociation.org#16088 ·
I maintainer di solito rispondono entro 1 giorno